我汇总了一个像这样的数据框:
x_mined_median = df[(df.Confirmed == True) & (df.Type == "Mined")].groupby(['dat']).median()
(缩短的)结果如下:
Confirmed Amount
dat
2017-09-01 True 836.202740
2017-09-03 True 650.958904
2017-09-04 True 150.076712
2017-09-07 True 445.928767
2017-09-08 True 382.439041
2017-09-10 True 401.145205
有没有办法获得Amount
列的中位数? (中位数的中位数?)
答案 0 :(得分:1)
选择列Amount
并获取median
:
x_mined_median = df[(df.Confirmed == True) & (df.Type == "Mined")].groupby(['dat']).median()
a = x_mined_median['Amount'].median()
替代解决方案:
x_mined_median = (df.loc[(df.Confirmed == True) & (df.Type == "Mined"), 'Amount']
.groupby(df['dat']).median())
a = x_mined_median.median()