pandas read json not working on MultiIndex

后端 未结 3 678
后悔当初
后悔当初 2020-12-11 16:25

I\'m trying to read in a dataframe created via df.to_json() via pd.read_json but I\'m getting a ValueError. I think it may have to do

3条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-11 16:55

    This is not implemented ATM, see the issue here: https://github.com/pydata/pandas/issues/4889.

    You can simply reset the index first, e.g

    df.reset_index().to_json(...)
    

    and it will work.

提交回复
热议问题