Sign inGet started
← Back to all guides

Analyzing e-commerce purchases data in Deepnote

By Filip Žitný

Updated on March 6, 2024

Let’s analyze E-commerce data using Deepnote and the pandas library. Aimed at all skill levels, this article provides a comprehensive approach to extracting insights from this dataset.

Import Necessary Libraries and Loading Data

First, let's import the pandas library and load the dataset into a DataFrame.

import pandas as pd

# Load the CSV file into a DataFrame
url = '<>'
ecom = pd.read_csv(url)

Exploring the Dataset

Let's check the structure and contents of the dataset to understand its dimensions and basic information.

# Display the first few rows of the DataFrame

To get an overview of the dataset:

# Check the number of rows and columns

Basic Data Analysis

Now, let's answer specific questions about the dataset using pandas operations:

Average Purchase Price

ecom['Purchase Price'].mean()

Highest and Lowest Purchase Prices

ecom['Purchase Price'].max()
ecom['Purchase Price'].min()

People with English as their Language of Choice

ecom[ecom['Language'] == 'en'].count()

People with the Job Title "Lawyer"

ecom[ecom['Job'] == 'Lawyer'].info()

Purchases made during AM and PM

ecom['AM or PM'].value_counts()

Top 5 Most Common Job Titles


Purchase Price for Lot "90 WT"

ecom[ecom['Lot'] == '90 WT']['Purchase Price']

Email of the Person with a Specific Credit Card Number

ecom[ecom['Credit Card'] == 4926535242672853]['Email']

People with American Express as their Credit Card Provider and Purchase above $95

ecom[(ecom['CC Provider'] == 'American Express') & (ecom['Purchase Price'] > 95)].count()

People with Credit Cards Expiring in 2025

sum(ecom['CC Exp Date'].apply(lambda x: x[3:]) == '25')

Top 5 Most Popular Email Providers/Hosts

ecom['Email'].apply(lambda x: x.split('@')[1]).value_counts().head(5)


With these steps, you can effectively analyze the E-commerce Purchases dataset using Deepnote and pandas. Each task leverages pandas' powerful capabilities for data manipulation and analysis, demonstrating how straightforward it is to perform complex queries and calculations concisely.

This guide provides a comprehensive approach to exploring and analyzing the dataset, ensuring you can derive meaningful insights efficiently. If you encounter any issues, please get in touch with our support. Happy coding in Deepnote!

Filip Žitný

Data Scientist

Follow Filip on Twitter, LinkedIn and GitHub

That’s it, time to try Deepnote

Get started – it’s free
Book a demo



  • Integrations
  • Pricing
  • Documentation
  • Changelog
  • Security




  • Privacy
  • Terms

© Deepnote