What does `ValueError: cannot reindex from a duplicate axis` mean?
Indices with duplicate values often arise if you create a DataFrame by concatenating other DataFrames. IF you don't care about preserving the values of your index, and you want them to be unique values, when you concatenate the the data, set ignore_index=True
.
Alternatively, to overwrite your current index with a new one, instead of using df.reindex()
, set:
df.index = new_index