Examples

In [1]:
import numpy as np
import pandas as pd
In [2]:
df = pd.DataFrame(np.array([[2, 2], [3, 20], [4, 200], [5, 200]]),
                  columns=['p', 'q'])
df.quantile(.1)
Out[2]:
p    2.3
q    7.4
Name: 0.1, dtype: float64
In [3]:
df.quantile([.2, .5])
Out[3]:
p q
0.2 2.6 12.8
0.5 3.5 110.0

Specifying numeric_only=False will also compute the quantile of datetime and timedelta data:

In [4]:
df = pd.DataFrame({'P': [2, 3],
                   'Q': [pd.Timestamp('2018'),
                         pd.Timestamp('2019')],
                   'R': [pd.Timedelta('1 days'),
                         pd.Timedelta('2 days')]})
df.quantile(0.3, numeric_only=False)
Out[4]:
P                    2.3
Q    2018-04-20 12:00:00
R        1 days 07:12:00
Name: 0.3, dtype: object