⚡0 XP🔥0

Module Project: Exploratory Data Analysis (EDA)

Lesson 7 of 7 ⏱ 5 min read ✎ 2 exercises ❓ 3-question quiz ▶ Runs Python

Run a complete EDA in Python - understand, clean, analyse univariate, bivariate and time patterns, segment customers, and write insights - on Vindhya Mart, then independently on the Kaggle Diwali Sales dataset.

What is EDA?#

Exploratory Data Analysis is the detective work you do before conclusions: understand what's in the data, check its quality, and discover patterns, relationships and surprises - with statistics and charts.

हिंदी में समझें

EDA (Exploratory Data Analysis) = data की जासूसी। निष्कर्ष निकालने से पहले data को अच्छे से समझना - उसमें क्या है, कितना साफ़ है, कौन-से pattern हैं, कौन-सी चीज़ें अजीब (surprising) हैं।

एक अच्छा EDA हमेशा सवालों से शुरू होता है, हर finding के साथ सबूत (number या chart) होता है, और आखिर में insights + सुझाव लिखे जाते हैं।

The EDA framework#

Step Questions Tools
1. Understand What does one row mean? What are the columns? Time period? head, info, data dictionary
2. Quality Missing? Duplicates? Wrong types? Impossible values? isna, duplicated, describe
3. Univariate Distribution of each important column value_counts, hist, describe
4. Bivariate How do pairs relate? (category vs sales, discount vs profit) groupby, pivot_table, scatter, corr
5. Time Trends, seasonality, growth resample, line charts
6. Segments Which customers/products/regions behave differently? groupby, ranking, RFM
7. Insights So what? What should the business do? written summary

Guided EDA - Vindhya Mart#

Run each block and write down one finding after each.

1-2. Understand and check quality#

▶ Try it Yourselfsales.csvPython
Ctrl + Enter to run

3. Univariate#

▶ Try it Yourselfsales.csvPython
Ctrl + Enter to run

4. Bivariate#

▶ Try it Yourselfsales.csvPython
Ctrl + Enter to run

5. Time patterns#

▶ Try it Yourselfsales.csvPython
Ctrl + Enter to run

6. Segments#

▶ Try it Yourselfsales.csvPython
Ctrl + Enter to run

7. Write insights#

Example format:

Finding: Technology is 70% of sales but only 43% of profit (8.3% margin), and 54 of the 57 loss-making orders are Technology orders at 15%+ discount. So what: discounts on phones and laptops wipe out their thin margin. Action: cap Technology discounts at 10%; use free accessories instead of price cuts.

Your turn - Kaggle Diwali Sales EDA#

Kaggle - Diwali Sales Dataset

Link: kaggle.com/datasets/saadharoon27/diwali-sales-dataset

Sales of an Indian retail store during the Diwali festival - customer gender, age group, marital status, state, zone, occupation, product category, number of orders and amount. File: Diwali Sales Data.csv (~11,000 rows).

Work in Google Colab (free, nothing to install) or Jupyter:

import pandas as pd
df = pd.read_csv("Diwali Sales Data.csv", encoding="unicode_escape")   # this file needs this encoding
Diwali Sales EDA - tasks
  1. Understand: shape, columns, data types, what one row represents.
  2. Clean: drop empty/unnamed columns, handle missing Amount, fix data types, check duplicates.
  3. Univariate: distribution of Amount (histogram), counts by Gender, Age Group, Marital_Status, Occupation.
  4. Bivariate: total Amount by Gender; by Age Group and Gender together; by State (top 10); by Occupation; by Product_Category (top 10).
  5. Charts: at least 6 clear charts with insight titles.
  6. Segments: who is the most valuable customer group? (Combine gender + age group + marital status + state.)
  7. Insights: write 5 insights and 3 recommendations for next Diwali's marketing (which customers, states and categories to target).
  8. Share: download the notebook (.ipynb) and keep it for your portfolio / GitHub.
Tip

Column names in Kaggle files can include spaces and odd capitalisation - run df.columns first, and rename with df.columns = df.columns.str.strip().str.lower().str.replace(" ", "_") to make them easy to type.

Summary#

  • EDA = understand → quality → univariate → bivariate → time → segments → insights.
  • Back every finding with a number or chart; write insights as finding + so what + action.
  • You've practised a full EDA on Vindhya Mart and will repeat it independently on real Kaggle data.

Practice Exercises

Write your code, then press Check. Your program is tested automatically.

1

Customer summary (RFM-lite)

Create customers - one row per customer_id with:

  • orders - number of orders
  • total_sales - sum of sales
  • last_order - most recent order_date

Then top10 = the 10 customers with the highest total_sales (DataFrame, highest first).

Dataset: sales.csv (already loaded - just use the file name)
2

Weekday pattern

Create by_day = total sales per day name (Monday...Sunday) in calendar order (Monday first). Then best_day = the day with the highest sales.

Dataset: sales.csv (already loaded - just use the file name)

Quick Quiz

Q1.

What is the main goal of EDA?

Q2.

Univariate analysis looks at...

Q3.

Which is a good EDA habit?