Group by Department and get average salary
🔹 Introduction to Descriptive Statistics (in Pandas)
Descriptive statistics summarize data to understand patterns and distributions.
Use .describe() or individual methods like .mean(), .median(), .std(), etc.
✅ Example:
import pandas as pd
data = {'Marks': [80, 90, 85, 70, 95]}
df = pd.DataFrame(data)
print(df.describe())
Output:
Marks
count 5.000000
mean 84.000000
std 9.617692
min 70.000000
25% 80.000000
50% 85.000000
75% 90.000000
max 95.000000
🔹 Individual Functions
df['Marks'].mean() # Average
df['Marks'].median() # Middle value
df['Marks'].std() # Standard deviation
df['Marks'].min() # Lowest mark
df['Marks'].max() # Highest mark
📌 Summary Table
| Function | Description |
|---|---|
.describe() |
Summary statistics |
.mean() |
Average |
.groupby() |
Group and apply functions |
.agg() |
Apply multiple functions |
Tags: #programming #tools