Skip to content
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

BUG: np.min on DataFrame with a non-ordered Categorical col #28949

Closed
jbrockmendel opened this issue Oct 13, 2019 · 2 comments · Fixed by #37827
Closed

BUG: np.min on DataFrame with a non-ordered Categorical col #28949

jbrockmendel opened this issue Oct 13, 2019 · 2 comments · Fixed by #37827
Labels
Bug Categorical Categorical Data Type Numeric Operations Arithmetic, Comparison, and Logical operations Reduction Operations sum, mean, min, max, etc.
Milestone

Comments

@jbrockmendel
Copy link
Member

Discovered while debugging the try/excepts in groupby:

cat = pd.Categorical(['a', 'b', 'c', 'b'], ordered=False)
ser = pd.Series(cat)
df = ser.to_frame()
>>> np.min(cat)   # <-- correctly raises
>>> np.min(ser)   # <-- correctly raises
>>> np.min(df)     # <-- incorrectly returns Series(['a'])
@rohitsanj
Copy link
Contributor

rohitsanj commented Oct 13, 2019

I think this is more of a numpy issue than pandas?

@jbrockmendel
Copy link
Member Author

Definitely a pandas issue. It's going to be in DataFrame.__array_ufunc__ or something like that calling \.values

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Categorical Categorical Data Type Numeric Operations Arithmetic, Comparison, and Logical operations Reduction Operations sum, mean, min, max, etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants