Skip to content

Series.quantile() should convert input dtype to float #6555

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

Closed
nspies opened this issue Mar 5, 2014 · 1 comment · Fixed by #6558
Closed

Series.quantile() should convert input dtype to float #6555

nspies opened this issue Mar 5, 2014 · 1 comment · Fixed by #6558
Labels
Bug Dtype Conversions Unexpected or buggy dtype conversions Numeric Operations Arithmetic, Comparison, and Logical operations
Milestone

Comments

@nspies
Copy link
Contributor

nspies commented Mar 5, 2014

Would love it if Series.quantile() converted the dtype to float (as DataFrame.quantile() appears to do). As it is, I get the following error with dtype=object:

In [8]: low
Out[8]: 
...
Name: p, Length: 2218, dtype: object

In [9]: low.quantile(0.33)
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/ase/src/ase/analysis/conservation.py in <module>()
----> 1 low.quantile(0.33)

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas/core/series.pyc in quantile(self, q)
   1323             return pa.NA
   1324         result = _quantile(valid_values, q * 100)
-> 1325         if result.dtype == _TD_DTYPE:
   1326             from pandas.tseries.timedeltas import to_timedelta
   1327             return to_timedelta(result)

AttributeError: 'float' object has no attribute 'dtype'
@jreback
Copy link
Contributor

jreback commented Mar 5, 2014

hmm...it shouldn't error like that. You should convert youself, s.convert_objects()

in general keeping things as object is not a good idea

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Dtype Conversions Unexpected or buggy dtype conversions Numeric Operations Arithmetic, Comparison, and Logical operations
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants