Skip to content

BUG: Series.quantile raising on an object dtype (GH6555) #6558

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 6, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/source/release.rst
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ Bug Fixes
wrong data types and missing values (:issue:`6335`)
- Inconsistent types in Timestamp addition/subtraction (:issue:`6543`)
- Bug in indexing: empty list lookup caused ``IndexError`` exceptions (:issue:`6536`, :issue:`6551`)

- Series.quantile raising on an ``object`` dtype (:issue:`6555`)

pandas 0.13.1
-------------
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -1287,7 +1287,7 @@ def quantile(self, q=0.5):
if len(valid_values) == 0:
return pa.NA
result = _quantile(valid_values, q * 100)
if result.dtype == _TD_DTYPE:
if not np.isscalar and com.is_timedelta64_dtype(result):
from pandas.tseries.timedeltas import to_timedelta
return to_timedelta(result)

Expand Down
4 changes: 4 additions & 0 deletions pandas/tests/test_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -2102,6 +2102,10 @@ def test_quantile(self):
q = self.ts.quantile(0.9)
self.assertEqual(q, scoreatpercentile(self.ts.valid(), 90))

# object dtype
q = Series(self.ts,dtype=object).quantile(0.9)
self.assertEqual(q, scoreatpercentile(self.ts.valid(), 90))

def test_describe(self):
_ = self.series.describe()
_ = self.ts.describe()
Expand Down