You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The dtypes on a data frame multi-index with no rows are lost when the index is reset. As you can see from the above sample, setting the index preserves the correct dtypes in the multi-index levels. When the index is reset, the dtypes become float64. Instead, I would expect the dtypes for time and index to be datetime64[ns] and int64 when the index is reset.
Note: The behavior is correct when there is at least one row in the data frame and this bug only occurs when the data frame has no rows.
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
(optional) I have confirmed this bug exists on the master branch of pandas.
Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.
Code Sample, a copy-pastable example
Problem description
The dtypes on a data frame multi-index with no rows are lost when the index is reset. As you can see from the above sample, setting the index preserves the correct dtypes in the multi-index levels. When the index is reset, the dtypes become
float64
. Instead, I would expect the dtypes fortime
andindex
to bedatetime64[ns]
andint64
when the index is reset.Note: The behavior is correct when there is at least one row in the data frame and this bug only occurs when the data frame has no rows.
Expected Output
Output of
pd.show_versions()
The text was updated successfully, but these errors were encountered: