Skip to content

NaT in MultiIndex throws ValueError when reset_index() is called. #10388

Closed
@jstritar

Description

@jstritar

Please see this test case:

x = pp.DataFrame({
    'other': ['a', np.nan],
    'date': ['2015-03-22', np.nan],
    'amount': [2, 3]
  })
x.date = pp.to_datetime(x.date)
index amount date other
0 2 2015-03-22 a
1 3 NaT NaN

The reset_index here then fails with the error below:

x.set_index(['other', 'date']).reset_index()

ValueError: Converting an integer to a NumPy datetime requires a specified unit

pp.version.version
'0.16.1'
pp.np.version.version
'1.7.1'

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugDatetimeDatetime data dtypeIndexingRelated to indexing on series/frames, not to indexes themselvesMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolateMultiIndex

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions