Skip to content

BUG: Series.quantile dtype / nan handling issue #12772

Closed
@sinhrks

Description

@sinhrks

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugNumeric OperationsArithmetic, Comparison, and Logical operations

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions