Skip to content

BUG: Series.min() fails for string series containing None #4006

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
miketkelly opened this issue Jun 23, 2013 · 4 comments
Closed

BUG: Series.min() fails for string series containing None #4006

miketkelly opened this issue Jun 23, 2013 · 4 comments
Labels
Bug Dtype Conversions Unexpected or buggy dtype conversions Strings String extension data type and string data
Milestone

Comments

@miketkelly
Copy link

>>> s = pd.Series([None, 'a', 'b'])
>>> s
0    None
1       a
2       b
dtype: object
>>> s.min()
inf
@jreback
Copy link
Contributor

jreback commented Jun 23, 2013

this is an undefined operation

what would you have this return?

@miketkelly
Copy link
Author

In Python 2 at least the object ordering is well defined. I'd expect similar behavior to numpy, although I'd prefer 'a' as an answer. I just don't get inf.

>>> pd.np.min(s.values) == None
True

Is this an undefined operation because its an object series? Or is it undefined because it as None in it?


>>> s = pd.Series([None, Decimal(1), Decimal(2)])
>>> s
0    None
1       1
2       2
dtype: object
>>> s.min()
Decimal('1')
>>> s.max()
Decimal('2')
>>> pd.np.min(s.values) == None
True

@jreback
Copy link
Contributor

jreback commented Jun 24, 2013

None are really a funny object, as in any other dtype they are converted to nan. It should be treated as missing though, so marking as a bug.

@jreback
Copy link
Contributor

jreback commented Feb 18, 2014

dupe of #4147

@jreback jreback closed this as completed Feb 18, 2014
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 Strings String extension data type and string data
Projects
None yet
Development

No branches or pull requests

2 participants