ImportError: No module named 'pandas.indexes'

前端 未结 7 999
独厮守ぢ
独厮守ぢ 2020-12-01 17:49

Importing pandas didn\'t throw the error, but rather trying to read a picked pandas dataframe as such:

import numpy as np
import pandas as pd
import matplotl         


        
7条回答
  •  没有蜡笔的小新
    2020-12-01 18:28

    If you want to read pickled text instead of a file, do

    import io
    
    pd.read_pickle(io.BytesIO(pickled_text))
    

    If you face the error - ValueError: Unrecognized compression type: infer,
    explicitly mention the compression type. It could be one of None(no compression), gzip, bz2, xz or zip(depending upon file extension).
    pd.read_pickle(io.BytesIO(pickled_text), compression=None)

提交回复
热议问题