【问题标题】:How to read boto3 StreamingBody into .parquet file?如何将 boto3 StreamingBody 读入 .parquet 文件?
【发布时间】:2020-06-26 06:28:57
【问题描述】:

我正在读取一个包含 pandas 数据框的镶木地板文件。

o = s3_client.get_object(Bucket='zak-zak', Key='2020-01/2000001.parq')
o['Body'].read()

'b\'PAR1\\x15\\x00\\x15,\\x15,,\\x15\\x02\\x15\\x00\\x15\\x06\\x15\\x08\\x00\\x00\\x02\\x00\\ 但它是位格式的。

如何将其转换为正常的 df 或文件格式?

【问题讨论】:

    标签: pandas dataframe boto3 parquet


    【解决方案1】:

    您是否尝试过使用o['Body'].read().decode('utf-8')

    【讨论】:

    • 我得到 UnicodeDecodeError: 'utf-8' codec can't decode byte 0xca in position 132: invalid continuation byte
    猜你喜欢
    • 2019-09-07
    • 2016-02-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-04
    • 2021-10-15
    • 1970-01-01
    相关资源
    最近更新 更多