我正在尝试使用Vaex从Parquet文件中读取一些数据到Python中。
这是使用vaex.open
函数获得的输出结果。
>>> import vaex
>>> trade = vaex.open('trade.parquet')
>>> trade
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/userman/.local/lib/python3.6/site-packages/vaex/dataframe.py", line 3703, in __repr__
return self._head_and_tail_table(format='plain')
File "/home/userman/.local/lib/python3.6/site-packages/vaex/dataframe.py", line 3464, in _head_and_tail_table
return self._as_table(0, n, N - n, N, format=format)
File "/home/userman/.local/lib/python3.6/site-packages/vaex/dataframe.py", line 3599, in _as_table
parts = table_part(i1, i2, parts)
File "/home/userman/.local/lib/python3.6/site-packages/vaex/dataframe.py", line 3573, in table_part
df = self[k1:k2]
File "/home/userman/.local/lib/python3.6/site-packages/vaex/dataframe.py", line 4626, in __getitem__
df = self.trim()
File "/home/userman/.local/lib/python3.6/site-packages/vaex/dataframe.py", line 3859, in trim
df = self if inplace else self.copy()
File "/home/userman/.local/lib/python3.6/site-packages/vaex/dataframe.py", line 5036, in copy
df.add_column(name, column, dtype=self._dtypes_override.get(name))
File "/home/userman/.local/lib/python3.6/site-packages/vaex/dataframe.py", line 6053, in add_column
super(DataFrameArrays, self).add_column(name, data, dtype=dtype)
File "/home/userman/.local/lib/python3.6/site-packages/vaex/dataframe.py", line 2942, in add_column
raise ValueError("array is of length %s, while the length of the DataFrame is %s" % (len(ar), self.length_original()))
ValueError: array is of length 1048576, while the length of the DataFrame is 34421587
数据框架的长度是正确的,但我不理解
1048576
与什么相关。我找到了一个有关读取hdf5文件的 之前的答案 ,但它似乎与我的问题无关。该数据最初从csv文件中读取,然后使用pyarrow导出为parquet格式。有人能详细说明问题是什么以及如何解决吗?