Descriptive Statistics and Value Counts
After cleaning and preparing your DataFrame, the next step is to explore the distribution and summary of your data.
Pandas offers straightforward yet powerful tools for generating quick statistical overviews — helping you identify trends, anomalies, and insights with ease.
Descriptive Methods
Use .describe() to get a quick statistical summary of all numeric columns:
- Count of non-null values
- Mean and standard deviation
- Minimum and maximum values
- 25%, 50%, and 75% percentiles
This method is your go-to tool for initial data exploration and profiling.
Categorical Analysis with value_counts()
To summarize non-numeric (categorical) columns, use .value_counts().
It returns the frequency of each unique value in a column.
df = pd.DataFrame({ "Category": ["A", "A", "B", "B", "C", "C"] }) df["Category"].value_counts() # Output: # B 2 # A 2 # C 2
Common Additional Methods
| Method | Purpose |
|---|---|
mean() | Average value |
median() | Middle value |
std() | Standard deviation |
min() / max() | Minimum and maximum values |
sum() | Total sum of column |
count() | Number of non-null entries |
You can apply these methods to individual columns or across the entire DataFrame to gain a deeper statistical understanding of your dataset.
Which method in pandas is used to get a quick statistical summary of all numeric columns in a DataFrame?
.value_counts()
.mean()
.describe()
.sum()
Lecture
AI Tutor
Design
Upload
Notes
Favorites
Help