des_table = df_final_S1415.describe(percentiles=[.05, .25, .5, .75, .95 ]).T
在 18.0 版中,当列包含 nan 时,describe 函数将返回百分位数。
pd.show_versions()
但是在 18.1 版中,当列包含 nan 时,describe 函数将不会返回百分位数。
@tade0726你能举一个可重复的例子吗? (一些构建显示问题的数据框的代码)
这是一个可重现的示例(实际问题在quantile
方法中):
In [24]: s = pd.Series(range(5))
In [25]: s.quantile(0.5)
Out[25]: 2.0
In [26]: s[0] = np.nan
In [27]: s.quantile(0.5)
Out[27]: nan
In [28]: pd.__version__
Out[28]: '0.18.1+20.gaf7bdd3'
最有用的评论
这是一个可重现的示例(实际问题在
quantile
方法中):