Examples
import numpy as np
import pandas as pd
s = pd.Series([2, 3, 4])
s.describe()
Describing a categorical Series:
s = pd.Series(['p', 'p', 'q', 'r'])
s.describe()
Describing a timestamp Series.
s = pd.Series([
np.datetime64("2018-02-01"),
np.datetime64("2019-02-01"),
np.datetime64("2019-02-01")
])
s.describe()
Describing a DataFrame. By default only numeric fields are returned:
df = pd.DataFrame({'categorical': pd.Categorical(['s','t','u']),
'numeric': [2, 3, 4],
'object': ['p', 'q', 'r']
})
df.describe()
Describing all columns of a DataFrame regardless of data type:
df.describe(include='all')
Describing a column from a DataFrame by accessing it as an attribute:
df.numeric.describe()
Including only numeric columns in a DataFrame description.
df.describe(include=[np.number])
Including only string columns in a DataFrame description:
df.describe(include=[np.object])
Including only categorical columns from a DataFrame description:
df.describe(include=['category'])
Excluding numeric columns from a DataFrame description:
df.describe(exclude=[np.number])
Excluding object columns from a DataFrame description:
df.describe(exclude=[np.object])