Skip to content
Merged
Prev Previous commit
Next Next commit
Clarified comment
  • Loading branch information
TomAugspurger committed Apr 27, 2018
commit 69701f2bd0d384abc465cccfbdc315a8af216cd3
6 changes: 3 additions & 3 deletions pandas/core/arrays/categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -1780,9 +1780,9 @@ def take_nd(self, indexer, allow_fill=None, fill_value=None):
warn(_take_msg, FutureWarning, stacklevel=2)
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe just put the warning inline here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That messes with the formatting.

allow_fill = True

if fill_value is None or isna(fill_value):
# The isna(fill_value) is included for backwards compatability.
# Categorical overrides any NA value with -1.
if isna(fill_value):
# For categorical, any NA value is considered a user-facing
Copy link
Contributor

Choose a reason for hiding this comment

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

is this condition tested?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep.

# NA value. Our storage NA value is -1.
fill_value = -1

codes = take(self._codes, indexer, allow_fill=allow_fill,
Expand Down