Skip to content

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