pandas quantile 分位函数

 

import pandas as pd
import numpy as np
dt = pd.Series(np.array([6, 47, 49, 15, 42, 41, 7, 39, 43, 40, 36]))

print('Q1:', dt.quantile(.25))
print('Q2:', dt.quantile(.5))
print('Q3:', dt.quantile(.75))

Q1: 25.5
Q2: 40.0
Q3: 42.5

http://www.waitingfy.com/archives/5321

5321

Leave a Reply

Name and Email Address are required fields.
Your email will not be published or shared with third parties.