Skip to content

REGR: pd.unique casts nan to string with other strings #16107

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

Closed
TomAugspurger opened this issue Apr 24, 2017 · 1 comment · Fixed by #16108
Closed

REGR: pd.unique casts nan to string with other strings #16107

TomAugspurger opened this issue Apr 24, 2017 · 1 comment · Fixed by #16108
Labels
Dtype Conversions Unexpected or buggy dtype conversions Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate Regression Functionality that used to work in a prior pandas version
Milestone

Comments

@TomAugspurger
Copy link
Contributor

Code Sample, a copy-pastable example if possible

In [1]: import numpy as np; import pandas as pd
In [2]: pd.unique(['a', np.nan, 'c', 'c'])
Out[2]: array(['a', 'nan', 'c'], dtype=object)

In [3]: pd.__version__
Out[3]: '0.20.0rc1'

Notice the quotes around 'nan'. This came up from the seaborn test suite

w#### Expected Output

# 0.19.2
In [1]: import numpy as np; import pandas as pd
In [2]: pd.unique(['a', np.nan, 'c', 'c'])
Out[2]: array(['a', nan, 'c'], dtype=object)
@TomAugspurger TomAugspurger added Dtype Conversions Unexpected or buggy dtype conversions Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate Regression Functionality that used to work in a prior pandas version labels Apr 24, 2017
@TomAugspurger TomAugspurger added this to the 0.20.0 milestone Apr 24, 2017
@TomAugspurger TomAugspurger changed the title REGR: pd.unique casts nan to string REGR: pd.unique casts nan to string with other strings Apr 24, 2017
@jreback
Copy link
Contributor

jreback commented Apr 24, 2017

hmm, unique is taking a more general path now, I think this is inferred to string (and not object)

jreback added a commit to jreback/pandas that referenced this issue Apr 24, 2017
jreback added a commit to jreback/pandas that referenced this issue Apr 24, 2017
jreback added a commit to jreback/pandas that referenced this issue Apr 24, 2017
jreback added a commit to jreback/pandas that referenced this issue Apr 24, 2017
jreback added a commit to jreback/pandas that referenced this issue Apr 25, 2017
jreback added a commit to jreback/pandas that referenced this issue Apr 25, 2017
pcluo pushed a commit to pcluo/pandas that referenced this issue May 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dtype Conversions Unexpected or buggy dtype conversions Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate Regression Functionality that used to work in a prior pandas version
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants