Quickly inspect distributions and common summary measures before deeper analysis.
Initial dataset inspection
Pandas · Function
DataFrame.describe generates descriptive statistics for analyzed columns, excluding NaN values. It can summarize mixed-type DataFrames and filter analyzed columns with include or exclude.
Call this method on a DataFrame to produce column-wise descriptive statistics. It ignores missing values, uses standard numeric summaries for numeric columns, and can include or exclude columns by dtype through its optional filters.
DataFrame.describe(percentiles=None, include=None, exclude=None)| Name | Type | Description |
|---|---|---|
percentiles | list-like, optional | Percentile levels to include in the result; values must be between 0 and 1. If omitted, the method uses the 25th, 50th, and 75th percentiles. |
include | scalar or list-like, optional | Dtype or dtypes whose columns should be included in the analysis. |
exclude | scalar or list-like, optional | Dtype or dtypes whose columns should be omitted from the analysis. |
Series or DataFrame containing summary statistics for the supplied data.
import pandas as pd
frame = pd.DataFrame({
"score": [10, 20, 30, None],
"team": ["A", "A", "B", "B"],
})
print(frame.describe())
print(frame.describe(include=["object"]))Creates a mixed-type DataFrame, prints numeric summary statistics, then explicitly summarizes the object column.
Initial dataset inspection
Mixed-type profiling
Dtype-focused analysis
It returns descriptive statistics for the analyzed DataFrame columns and omits NaN values from those calculations. Numeric columns produce measures such as count, mean, standard deviation, minimum, maximum, and requested percentiles.
Follow-up: How would you summarize non-numeric columns? Pass an appropriate dtype through include, such as include=["object"], so those columns are analyzed.
By default, the percentile argument is None, which causes the method to include the 25th, 50th, and 75th percentiles. You can provide a list-like collection to request different percentile levels.
Follow-up: What validation constraint applies to custom percentile values? Each value must fall between 0 and 1.
The include and exclude arguments restrict the columns analyzed according to dtype. This lets a caller select non-numeric columns, omit particular dtype groups, or otherwise narrow the DataFrame summary.
Follow-up: What happens if the filters select incompatible or overlapping dtype groups? The method validates the requested selection and may raise an error rather than producing an ambiguous summary.
DataFrame.infoSeries.describe