BUG: 1.4.0 does not preserve initially empty Index and appended by loc
assignment.
#45621
Closed
2 of 3 tasks
Labels
Bug
Indexing
Related to indexing on series/frames, not to indexes themselves
Regression
Functionality that used to work in a prior pandas version
Milestone
Pandas version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
Given an empty dataframe with a index column name set, when adding a row on a specific index using
df.loc[INDEX]
, the original index is not preserved. Furthermore, what gets returned is not typeIndex
but isInt64Index
when the passed in index is an integer.Expected Behavior
The modified index should print out
Index([0], dtype='int64', name='a')
.Installed Versions
1.4.0
The text was updated successfully, but these errors were encountered: