我有一个看起来像的文件
2|1|abc
3|4|def
from pyarrow import csv
a = csv.read_csv("file.csv", parse_options=csv.ParseOptions(delimiter="|", header_rows=0))
那么如何指定明确的列名呢?在文档中找不到。
Traceback (most recent call last):
File "C:\data\dask\venv\lib\site-packages\IPython\core\interactiveshell.py", line 3326, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-15-18e80408b284>", line 2, in <module>
a = csv.read_csv("c:/data/Performance_All/Performance_2003Q3.txt", parse_options=csv.ParseOptions(delimiter="|", header_rows=0))
File "pyarrow\_csv.pyx", line 450, in pyarrow._csv.read_csv
File "pyarrow\error.pxi", line 85, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: header_rows == 0 needs explicit column names