我正在尝试在pandas数据帧中读取一个镶木地板文件,进行一些操作并将其写回同一个文件中,但是在第一次读取相同函数后,似乎无法访问文件。
只有在我不执行下面的步骤1时才有效。 反正有没有解锁文件?
#STEP 1: Read entire parquet file
pq_file = pq.ParquetFile('\dev\abc.parquet')
exp_df = pq_file.read(nthreads=1, use_pandas_metadata=True).to_pandas()
#STEP 2:
# Change some data in dataframe
#STEP 3: write merged dataframe
pyarrow_table = pa.Table.from_pandas(exp_df)
pq.write_table(pyarrow_table, '\dev\abc.parquet',compression='none',)
错误:
File "C:\Python36\lib\site-packages\pyarrow\parquet.py", line 943, in
write_table
**kwargs)
File "C:\Python36\lib\site-packages\pyarrow\parquet.py", line 286, in
__init__
**options)
File "_parquet.pyx", line 832, in pyarrow._parquet.ParquetWriter.__cinit__
File "error.pxi", line 79, in pyarrow.lib.check_status
pyarrow.lib.ArrowIOError: Failed to open local file: \dev\abc.parquet ,
error: Invalid argument