代码段
import pandas as pd import pyarrow.parquet as pq import pyarrow as pa out_file = 'test.parquet' array = [1, 2, 3, 4] df = pd.Dataframe(array) # Create a parquet table from your dataframe table = pa.Table.from_pandas(df) # Write direct to your parquet file pq.write_table(table, out_file) # write to this dir and auto name the parquet file out_path = './database/' pq.write_to_dataset(table, root_path = out_path)
结果示例
pq.write_table
pq.write_to_dataset



