Skip to content

always use object as dtype when creating a string series #7

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
May 31, 2018

Conversation

clembou
Copy link
Owner

@clembou clembou commented May 31, 2018

The behaviour of

In [3]: object_data = ['silly walks', np.nan, 'dead parrot']
In [5]: pd.Series(object_data, dtype=str)

as changed in pandas 0.23.
it used to return:

Out[5]:
0    silly walks
1            NaN
2    dead parrot
dtype: object

but now returns

Out[5]:
0    silly walks
1            nan
2    dead parrot
dtype: object

using str as a dtype was probably a bad idea in the first place, so I changed it to object which is a supported dtype in pandas, and behaves as expected.

@clembou clembou merged commit 5b5dae6 into master May 31, 2018
@clembou clembou deleted the fix/pandas-0.23-compat branch May 31, 2018 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant