Skip to content

BUG: groupby.rank with MaskedArray incorrect casting #41010

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 4 commits into from
Apr 20, 2021

Conversation

jbrockmendel
Copy link
Member

  • closes #xxxx
  • tests added / passed
  • Ensure all linting tests pass, see here for how to run them
  • whatsnew entry

In master:

df = pd.DataFrame({"key": ["a"] * 4, "val": [1] * 4})
df["val"] = df["val"].astype("Int64")

>>> result = df.groupby("key").rank()
TypeError: cannot safely cast non-equivalent float64 to int64

Moves in the direction of sharing/generalizing _ea_wrap_cython_operation.

If I did this right, should avoid overlap with #40651.

@jbrockmendel jbrockmendel added Bug Groupby NA - MaskedArrays Related to pd.NA and nullable extension arrays labels Apr 19, 2021
Copy link
Member

@rhshadrach rhshadrach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, but seems this could use a line in the whatsnew

@rhshadrach rhshadrach added this to the 1.3 milestone Apr 20, 2021
@jreback jreback merged commit 9e09142 into pandas-dev:master Apr 20, 2021
@jreback
Copy link
Contributor

jreback commented Apr 20, 2021

thanks @jbrockmendel

@jbrockmendel jbrockmendel deleted the ref-gbcast branch April 20, 2021 22:59
yeshsurya pushed a commit to yeshsurya/pandas that referenced this pull request Apr 21, 2021
yeshsurya pushed a commit to yeshsurya/pandas that referenced this pull request May 6, 2021
JulianWgs pushed a commit to JulianWgs/pandas that referenced this pull request Jul 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Groupby NA - MaskedArrays Related to pd.NA and nullable extension arrays
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants