Pandas: DataFrame.describe can't return percentiles when data set contain nan

Created on 9 May 2016  ·  3Comments  ·  Source: pandas-dev/pandas

Code Sample, a copy-pastable example if possible

des_table = df_final_S1415.describe(percentiles=[.05, .25, .5, .75, .95 ]).T

Expected Output

In version 18.0 describe function will return percentiles when columns contain nan.

output of pd.show_versions()

But in version 18.1 describe function will not return percentiles when columns contain nan.

Duplicate

Most helpful comment

Here is a reproducible example (the actual issue is in the quantile method):

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'

All 3 comments

@tade0726 Can you please show a reproducible example? (some code that constructs a dataframe that shows the problem)

Here is a reproducible example (the actual issue is in the quantile method):

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'

And it is a duplicate of https://github.com/pydata/pandas/issues/13098

Thanks for reporting

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MatzeB picture MatzeB  ·  3Comments

matthiasroder picture matthiasroder  ·  3Comments

BDannowitz picture BDannowitz  ·  3Comments

andreas-thomik picture andreas-thomik  ·  3Comments

venuktan picture venuktan  ·  3Comments