Menu

Performing a Complete EDA Workflow

Performing a Complete EDA Workflow

A structured EDA workflow combines data inspection, statistical analysis, group comparisons, and visualization to answer a specific question.

Consider a retail dataset containing product, region, quantity, price, and customer rating.

Step 1: Prepare the Dataset

import pandas as pd

import matplotlib.pyplot as plt

df = pd.DataFrame({

"Product": ["Laptop", "Phone", "Tablet", "Laptop", "Phone", "Tablet"],

"Region": ["North", "South", "East", "South", "North", "East"],

"Quantity": [10, 25, 15, 12, 30, 18],

"Price": [55000, 30000, 25000, 55000, 30000, 25000],

"Rating": [4.5, 4.2, 4.0, 4.7, 4.4, 3.9]

})

df["Revenue"] = df["Quantity"] * df["Price"]

print(df.head())

The Revenue column is a derived variable calculated by multiplying quantity by price. Creating useful derived metrics often helps answer business questions more effectively.

Step 2: Summarize Overall Performance

print("Total revenue:", df["Revenue"].sum())

print("Average rating:", df["Rating"].mean())

print("Total units sold:", df["Quantity"].sum())

These metrics provide an overview of the dataset's overall performance.

Step 3: Compare Products and Regions

product_summary = df.groupby("Product").agg(

Total_Revenue=("Revenue", "sum"),

Total_Quantity=("Quantity", "sum"),

Average_Rating=("Rating", "mean")

)

print(product_summary)

This summary compares products across several measures. A product with the highest revenue may not have the highest quantity sold because prices differ.

Step 4: Visualize the Results

product_summary["Total_Revenue"].plot(

kind="bar",

title="Total Revenue by Product",

xlabel="Product",

ylabel="Revenue",

rot=0

)

plt.tight_layout()

plt.show()

The chart makes it easier to compare revenue across products than reading the raw records alone.

Step 5: Interpret the Findings

When interpreting the results, consider questions such as:

  • Which product contributes the most revenue?
  • Does a product sell many units but generate less revenue?
  • Are ratings similar across product categories?
  • Are any values missing, inconsistent, or unusually high?
  • Would additional data help explain the observed patterns?

EDA should produce evidence-based observations rather than unsupported conclusions. Documenting the findings also helps guide the next steps, such as selecting visualization techniques, performing statistical tests, or preparing data for machine learning.


Python for Data Science

VA

Vishalini A



Learn via Video Course

undefined Logo

NaN hrs



Get in Touch For Details