Skip to content

REGR: Fix IntervalIndex.map when result is object dtype #31232

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 1 commit into from
Jan 23, 2020

Conversation

jschendel
Copy link
Member

No whatnew since this is a regression.

@jschendel jschendel added Regression Functionality that used to work in a prior pandas version Interval Interval data type labels Jan 23, 2020
@jschendel jschendel added this to the 1.0.0 milestone Jan 23, 2020
@@ -164,22 +164,6 @@ def __contains__(self, key: Any) -> bool:
is_scalar(res) or isinstance(res, slice) or (is_list_like(res) and len(res))
)

# Try to run function on index first, and then on elements of index
# Especially important for group-by functionality
def map(self, mapper, na_action=None):
Copy link
Member Author

Choose a reason for hiding this comment

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

@jbrockmendel : do you have any issues with moving the map definition in DatetimeIndexOpsMixin down to ExtensionIndex so it's shared with IntervalIndex? This seems to more gracefully handle index specific attributes (e.g. freq for DTI, closed for II) than Index.map.

Copy link
Member

Choose a reason for hiding this comment

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

definitely on board with this if we can use this for the general case

@@ -808,6 +808,13 @@ def test_map_dictlike(self, mapper):
result = index.map(mapper(expected, index))
tm.assert_index_equal(result, expected)

def test_map_str(self):
Copy link
Member Author

Choose a reason for hiding this comment

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

Decided to write a common test for index.map(str) that shared across all index types since it didn't look like we were generically testing something similar. Can remove this an write and IntervalIndex specific test if that'd be preferred.

@jreback jreback merged commit 32d368b into pandas-dev:master Jan 23, 2020
@jreback
Copy link
Contributor

jreback commented Jan 23, 2020

thanks @jschendel

meeseeksmachine pushed a commit to meeseeksmachine/pandas that referenced this pull request Jan 23, 2020
TomAugspurger pushed a commit that referenced this pull request Jan 23, 2020
@jschendel jschendel deleted the extension-index-map branch February 24, 2020 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Interval Interval data type Regression Functionality that used to work in a prior pandas version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IntervalIndex.map raises "TypeError: Unexpected keyword arguments {'closed'}" in pandas 1.0.0rc0
4 participants