Menu

Descriptive Statistics and Correlation

Descriptive Statistics and Correlation

Statistics help you describe data with numbers. This topic covers the key measures every analyst uses to understand and compare data.

a. Measures of Central Tendency

Central tendency tells you where the middle of your data sits. The three main measures are the mean, the median, and the mode.

The mean is the average. The median is the middle value when data is sorted. The mode is the most common value. In Pandas, you use mean(), median(), and mode().

print(df["salary"].mean())
print(df["salary"].median())

When data has extreme values, the mean can be misleading. For example, a few very high salaries can pull the average up. In such cases, the median gives a better picture of a typical value.

b. Measures of Spread

Spread tells you how much the values vary. Two datasets can have the same average but very different spread. The main measures are range, variance, and standard deviation.

The range is the highest value minus the lowest. Variance and standard deviation show how far values are from the mean on average. A small standard deviation means values are close together.

print(df["salary"].std())
print(df["salary"].quantile([0.25, 0.5, 0.75]))

Quartiles split sorted data into four equal parts. The gap between the first and third quartile is called the IQR, which you will use again for outlier detection. The skew() method shows if data leans to one side.

c. Understanding Correlation

Correlation measures how two numeric columns move together. The value ranges from -1 to 1. A value near 1 means both rise together. A value near -1 means one rises as the other falls. A value near 0 means no clear link.

print(df["ad_spend"].corr(df["sales"]))
print(df.corr(numeric_only=True))

The second line gives a full correlation table for all numeric columns. You can then spot the strongest relationships at a glance.

Remember that correlation does not mean one thing causes the other. Ice cream sales and sunburns may rise together because of hot weather, not because one causes the other. Always think about the real reason behind a pattern.

d. Interpreting Statistical Results

Numbers need context. A mean of 50 means little until you know the unit, the spread, and what is normal for that data. Always read results together, not one by one.

Compare the mean and the median to check for skew. Look at the standard deviation to see how reliable the average is. Use correlation values as hints, not proof, and always check them with a chart.

When you share results, explain them in simple words. Instead of saying "the correlation is 0.82," say "ad spend and sales rise together very strongly." This helps non-technical readers understand your point.


Data Analysis with Python Handbook

WR

Wesline Rinisha



Learn via Video Course

Data Analysis and Processing with Python using Pandas - Data Science Course Logo

Data Analysis and Processing with Python using Pandas - Data Science Course

5 hrs



Get in Touch For Details