The error usually generates when you concatenate, reindexing or resampling a DataFrame which the index has duplicate values . When you get this "cannot reindex from a duplicate axis" error, first you have to just check if there is any duplication in your DataFrame column names using the code:
df[df.index.duplicated()]
If DataFrame has duplicate index values , then remove the duplicated index:
The error usually generates when you concatenate, reindexing or resampling a DataFrame which the index has duplicate values . When you get this "cannot reindex from a duplicate axis" error, first you have to just check if there is any duplication in your DataFrame column names using the code:
df[df.index. duplicated( )]
If DataFrame has duplicate index values , then remove the duplicated index:
df= df.loc[ ~df.index. duplicated( ), :]
http:// net-information s.com/ds/ err/reindex. htm