【发布时间】:2018-10-05 17:10:09
【问题描述】:
我在尝试读取熊猫泡菜时遇到错误,例如df.to_pickle() 方法,存储在 Google Cloud 存储中。我正在尝试执行以下操作:
path_to_gcs_file = 'gs://xxxxx'
f = file_io.FileIO(path_to_gcs_file, mode='r').read()
train_df = pd.read_pickle(f)
f.close()
我收到以下错误:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 0: invalid start byte
我也试过了:
f = BytesIO(file_io.read_file_to_string(path_to_gcs_file, binary_mode=True))
train_df = pd.read_pickle(f)
在本地有效,但在 CloudML 上无效!
f = file_io.read_file_to_string(path_to_gcs_file, binary_mode=True)
train_df = pd.read_pickle(f)
给我一个错误: AttributeError: 'bytes' 对象没有属性 'seek'
【问题讨论】:
标签: python pandas tensorflow google-cloud-ml