简体   繁体   中英

How to remove __null_dask_index from parquet file?

I am writing a df to a Parquet file using Dask :

df.to_parquet(file, compression='snappy', write_metadata_file=False,\
              engine='pyarrow', index=None)

I need to present the contents of the file in an online parquet viewer,

and the columns getting displayed are :

Column1  Column2  Column3  __null_dask_index__

How do I remove the __null_dask_index__ column?

The relevant kwarg here is write_index :

from dask.datasets import timeseries
from pyarrow.parquet import ParquetFile

df = timeseries(end='2000-01-03').reset_index()

for write_index in [True, False]:
    df.to_parquet('test.pqt', write_index=write_index)
    f = ParquetFile('test.pqt/part.0.parquet')
    print(f.schema.names)
# ['__null_dask_index__', 'timestamp', 'id', 'name', 'x', 'y']
# ['timestamp', 'id', 'name', 'x', 'y']

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM