Title: Descriptive Statistics For pandas Dataframe
Slug: pandas_dataframe_descriptive_stats
Summary: Descriptive Statistics For pandas Dataframe
Date: 2016-05-01 12:00
Category: Python
Tags: Data Wrangling
Authors: Chris Albon
In [40]:
import pandas as pd
In [41]:
data = {'name': ['Jason', 'Molly', 'Tina', 'Jake', 'Amy'],
'age': [42, 52, 36, 24, 73],
'preTestScore': [4, 24, 31, 2, 3],
'postTestScore': [25, 94, 57, 62, 70]}
df = pd.DataFrame(data, columns = ['name', 'age', 'preTestScore', 'postTestScore'])
df
Out[41]:
In [42]:
df['age'].sum()
Out[42]:
In [43]:
df['preTestScore'].mean()
Out[43]:
In [44]:
df['preTestScore'].cumsum()
Out[44]:
In [45]:
df['preTestScore'].describe()
Out[45]:
In [46]:
df['preTestScore'].count()
Out[46]:
In [47]:
df['preTestScore'].min()
Out[47]:
In [48]:
df['preTestScore'].max()
Out[48]:
In [49]:
df['preTestScore'].median()
Out[49]:
In [50]:
df['preTestScore'].var()
Out[50]:
In [51]:
df['preTestScore'].std()
Out[51]:
In [52]:
df['preTestScore'].skew()
Out[52]:
In [53]:
df['preTestScore'].kurt()
Out[53]:
In [54]:
df.corr()
Out[54]:
In [55]:
df.cov()
Out[55]: