In [1]:
import pandas as pd
In [2]:
df = pd.DataFrame({'col_1': range(5),
'col_2': [i ** 2 for i in range(5)],
'col_3': list('abcde')})
In [3]:
print(df)
In [4]:
print(df.median())
In [5]:
print(type(df.median()))
In [6]:
print(df.mean())
In [7]:
print(df['col_1'].median())
In [8]:
print(type(df['col_1'].median()))
In [9]:
df_even = pd.DataFrame({'col_1': range(6),
'col_2': [i ** 2 for i in range(6)],
'col_3': list('abcdef')})
In [10]:
print(df_even)
In [11]:
print(df_even.median())
In [12]:
print(df.median(axis=1))