Skip to content

TST: Check map function works with StringDtype (#40823) #41723

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 6 commits into from
Jun 2, 2021

Conversation

mdhsieh
Copy link
Contributor

@mdhsieh mdhsieh commented May 29, 2021

Checks map function output on 2 DataFrames with data type StringDtype.

import pandas._testing as tm


class TestMap:
Copy link
Contributor

Choose a reason for hiding this comment

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

we have extensive map tests here: pandas/tests/apply/test_series_apply.py

see if you can find something similar. you can use the fixture any_string_dtype to parmeterize this over various kinds of strings.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok moved. Should the fixture be used like this?

# parameter
test_series_map_stringdtype(any_string_dtype):
    ser1 = Series(
        # ...
        # then set here for all Series
        dtype=any_string_dtype,
    )

dtype=pd.StringDtype(),
)

tm.assert_frame_equal(result, expected)
Copy link
Contributor

Choose a reason for hiding this comment

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

this is a series method, so test on that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, updated the test.

@jreback jreback added Strings String extension data type and string data Testing pandas testing functions or related to the test suite labels May 31, 2021
@jreback jreback added this to the 1.3 milestone Jun 2, 2021
@jreback jreback merged commit 8caf370 into pandas-dev:master Jun 2, 2021
@jreback
Copy link
Contributor

jreback commented Jun 2, 2021

thanks @mdhsieh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Strings String extension data type and string data Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: Pandas map function does not work properly with StringDtype
2 participants