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)


   col_1  col_2 col_3
0      0      0     a
1      1      1     b
2      2      4     c
3      3      9     d
4      4     16     e

In [4]:
print(df.median())


col_1    2.0
col_2    4.0
dtype: float64

In [5]:
print(type(df.median()))


<class 'pandas.core.series.Series'>

In [6]:
print(df.mean())


col_1    2.0
col_2    6.0
dtype: float64

In [7]:
print(df['col_1'].median())


2.0

In [8]:
print(type(df['col_1'].median()))


<class 'numpy.float64'>

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)


   col_1  col_2 col_3
0      0      0     a
1      1      1     b
2      2      4     c
3      3      9     d
4      4     16     e
5      5     25     f

In [11]:
print(df_even.median())


col_1    2.5
col_2    6.5
dtype: float64

In [12]:
print(df.median(axis=1))


0     0.0
1     1.0
2     3.0
3     6.0
4    10.0
dtype: float64