Skip to content

Misbehaved reindexing with NaN labels #522

@wesm

Description

@wesm

from user report

In [116]: df = pandas.DataFrame([[1,2], [3,4], [numpy.nan,numpy.nan], [7,8], [9,10]], columns=['a', 'b'], index=[100.0, 101.0, numpy.nan, 102.0, 103.0])                 

In [117]: print df

--------> print(df)

       a    b

100.0  1    2

101.0  3    4

nan    NaN  NaN

102.0  7    8

103.0  9    10



#referencing anything after the nan in the index results in getting nans!

In [118]: df.reindex(index=[101.0, 102.0, 103.0])

Out[118]:

       a    b

101.0  3    4

102.0  NaN  NaN

103.0  NaN  NaN



#after nan = NaN again!

In [119]: df.reindex(index=[103.0])

Out[119]:

       a    b

103.0  NaN  NaN



#before nan looks good though

In [120]: df.reindex(index=[101.0])

Out[119]:

       a    b

101.0  3    4

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions