I merged many dataframes into bigger one,
pd.concat(dfs, axis=0)
then I can not dump it into json
(Pdb) df.to_json() *** ValueError: DataFrame index must be unique for orient='columns'.
How could I fix it ?
The error indicates that your dataframe index has non-unique (repeated) values. Since it appears you're not using the index, you could create a new one with:
df.reset_index(inplace=True)
or
df.reset_index(drop=True, inplace=True)
if you want to remove the previous index.
Check this link as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With