BUG: groupby.rank with MaskedArray incorrect casting by jbrockmendel · Pull Request #41010 · pandas-dev/pandas (original) (raw)
- 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.