Skip to content

Conversation

@jorisvandenbossche
Copy link
Member

Closes #31731

@jorisvandenbossche jorisvandenbossche added Bug Dtype Conversions Unexpected or buggy dtype conversions labels Feb 11, 2020
@jorisvandenbossche jorisvandenbossche added this to the 1.0.2 milestone Feb 11, 2020
def test_convert_string_dtype(self):
# https://github.com/pandas-dev/pandas/issues/31731 -> converting columns
# that are already string dtype
df = pd.DataFrame({"A": ["a", "b", "c"], "B": ["ä", "ö", "ü"]}, dtype="string")
Copy link
Contributor

Choose a reason for hiding this comment

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

can you parameterize using the nulls_fixture (and no null as you have now) as well

Copy link
Contributor

Choose a reason for hiding this comment

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

we may want to have a null_fixture_for_strings e.g. [None, np.nan, pd.NA]

Copy link
Member Author

Choose a reason for hiding this comment

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

There is no need to parametrize for nulls here, I think. I am creating this with dtype string, and once you have that dtype, there is no difference for different nulls. So it would be testing construction with different nulls, which isn't the goal here.

Copy link
Contributor

Choose a reason for hiding this comment

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

are there other tests that convert_dtypes on strings with nulls?

Copy link
Member Author

Choose a reason for hiding this comment

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

convert_dtypes doesn't care about nulls or not if the dtype is already "string".

But added one NA in the values.

@jorisvandenbossche
Copy link
Member Author

Updated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Dtype Conversions Unexpected or buggy dtype conversions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: DataFrame.convert_dtypes fails on column that is already "string" dtype

4 participants