Skip to content

TST: Add regression test for Series index.map failing (#20990) #29093

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
Nov 18, 2019

Conversation

Reksbril
Copy link
Contributor

@TomAugspurger TomAugspurger added this to the 1.0 milestone Oct 19, 2019
@TomAugspurger TomAugspurger added the Testing pandas testing functions or related to the test suite label Oct 19, 2019
@Reksbril Reksbril requested a review from WillAyd October 22, 2019 11:22
@Reksbril
Copy link
Contributor Author

Reksbril commented Nov 6, 2019

@WillAyd ping

Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

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

Minor comment otherwise lgtm

# see GH20990
count = 6
index = pd.date_range("2018-01-01", periods=count, freq="M", name=name)
a = pd.Series(np.arange(count), index=index)
Copy link
Member

Choose a reason for hiding this comment

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

Can you delete the Series altogether and just use tm.assert_index_equal? I don't think the Series is required at all

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean to make it look like following?

@pytest.mark.parametrize("name", [None, "name"]) 
def test_index_map(self, name):
        # see GH20990
        count = 6
        index = pd.date_range("2018-01-01", periods=count, freq="M", name=name).map(lambda x: (x.year, x.month))
        expected = pd.MultiIndex.from_product(
            ((2018,), range(1, 7)), names=[name, name]
        )
        tm.assert_index_equal(index, expected)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@WillAyd ping

@Reksbril Reksbril requested a review from WillAyd November 15, 2019 14:36
@jreback
Copy link
Contributor

jreback commented Nov 18, 2019

pls merge master

@pep8speaks
Copy link

pep8speaks commented Nov 18, 2019

Hello @Reksbril! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2019-11-18 15:55:56 UTC

@WillAyd WillAyd merged commit 545d175 into pandas-dev:master Nov 18, 2019
@WillAyd
Copy link
Member

WillAyd commented Nov 18, 2019

Thanks @Reksbril !

proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Index.map fails when index has a name and mapping returns tuple
5 participants