BUG: Series.quantile dtype / nan handling issue · Issue #12772 · pandas-dev/pandas (original) (raw)
Found some issues when working on #12572. Both being fixed.
Code Sample, a copy-pastable example if possible
1. DataFrame may coerce to float even if interpolation
# OK, same as numpy
pd.Series([1, 2, 3]).quantile([0.5], interpolation='lower').dtypes
# dtype('int64')
# NG, it must be int
pd.DataFrame({'A': [1, 2, 3]}).quantile([0.5], interpolation='lower').dtypes
# A float64
# dtype: object
2. May return scalar even if its input is a list-like
# NG, it must be a Series
pd.Series([]).quantile([0.2, 0.3])
# nan
output of pd.show_versions()
Current master.