Skip to content

## DO NOT MERGE. BUG: Fix .dropna() functionality for categorical indices #25091

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
wants to merge 7 commits into from
2 changes: 1 addition & 1 deletion pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -4615,7 +4615,7 @@ def dropna(self, axis=0, how='any', thresh=None, subset=None,
else:
raise TypeError('must specify how or thresh')

result = self.loc(axis=axis)[mask]
result = self.loc(axis=axis)[mask.to_numpy()]
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we not need the alignment from the index anymore?

Copy link
Contributor Author

@rs2 rs2 Feb 2, 2019

Choose a reason for hiding this comment

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

@TomAugspurger It turned out to be a bit wider issue. Kudos to @jorisvandenbossche for an insightful discussion. The behavior of an_index[mask], 'foo' in an_index, an_index.get_loc(mask) is currently inconsistent across various index types, in particular, Categorical(pd.interval_range(0.1, 3.14)), Categorical(pd.interval_range(1, 2)).

Does this require a separate issue, or I could just post repro snippets and outcomes as of 0.23.4 and 0.24.0 into #25087?


if inplace:
self._update_inplace(result)
Expand Down