Ravindra BagaleCourses & study guides मराठी Track your progress

12. Exploratory Data Analysis (EDA)

Data Science

12.3 Crosstab and Correlation Caution

pd.crosstab(df["city"], df["festival"], values=df["amount"], aggfunc="sum", fill_value=0)
# Numeric association (not causation!):
df[["amount", "delivery_mins"]].corr()

Ravindra Bagale's Tip

A strong value from corr() does not prove that a bigger amount causes more delivery minutes. A third factor, like festival rush, can push both up at the same time. corr() uses the Pearson method by default, which only measures a straight-line link, so write your finding carefully, for example "in this sample, bigger orders tend to take longer".