Skip to content

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

Closed
@TomAugspurger

Description

@TomAugspurger

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Dtype ConversionsUnexpected or buggy dtype conversionsMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolateRegressionFunctionality that used to work in a prior pandas version

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions