[Python] How to write a parquet bytes object as zipfile to disk

Discussão em 'Python' iniciado por Stack, Setembro 29, 2024.

  1. Stack

    Stack Membro Participativo

    I start with a pandas dataframe and I want to save that as a zipped parquet file, all in memory without intermediate steps on the disk. I have the following:

    bytes_buffer = BytesIO()
    df.to_parquet(bytes_buffer)
    bytes_value= bytes_buffer.getvalue()

    with ZipFile('example.zip', 'w') as zip_obj:
    zip_obj.write(bytes_buffer.getvalue())


    But I get this encoding error: ValueError: stat: embedded null character in path. I got my infos from the only link I found on creating zipfiles from within the memory: https://www.neilgrogan.com/py-bin-zip/

    Thank your for your help :)

    Continue reading...

Compartilhe esta Página