Issue
So I have a list of DataFrames. When trying to append them I get:
pandas.errors.InvalidIndexError: Reindexing only valid
with uniquely valued Index objects
However, my indexes are unique, example:
dfList[0].index
Index(['5560654070'], dtype='object')
fList[1].index
Index(['5562221068'], dtype='object')
When append()
, or concat()
, both give the error above.
dfList[0].append(dfList[1])
"""
pandas.errors.InvalidIndexError: Reindexing only valid with uniquely valued Index objects
"""
I have tried reset_index()
as well as ignore_index=True
, but nothing seems to work.
Solution
Found the reason for the errors. As somewhat of a pandas noob I thought the error only had to do with the index. However the problem was that I had duplicate columns in each DataFrame.
Answered By - henaxe
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.