I am trying to concatenate a list df_l
of ~200 Dataframes, which all have the same number of columns and names.
When I try to run:
df = pd.concat(df_l, axis=0)
it throws the error:
pandas.errors.InvalidIndexError: Reindexing only valid with uniquely valued Index objects
Following this post I tried to reset the index of each dataframe, but I'll still get the same error.
new_l = [df.reset_index(drop=True) for df in df_l]
pd.concat(new_l, axis=0)
Also pd.concat
arguments like ignore_index=True
did not help in any combination. Any advice?
Running on python 3.8
and pandas 1.4.2
.