小编vin*_*bie的帖子

为什么 arrow::ListArray::offsets() 产生的偏移量散布着零?

我正在尝试使用 C++ 读取包含浮点数列表的镶木地板文件中的数据。

\n

我使用以下 python 代码生成了一个简单的镶木地板文件:

\n
import polars as pl\nimport struct\nimport random\nimport pyarrow.parquet as pq\n\nfloatlist = []\nfor _ in range(10):\n  lstlen = random.choice([3, 4, 5])\n  floatlist.append([random.random() for _ in range(lstlen)])\n\ndf = pl.DataFrame({"float_list": floatlist})\n\nfile_out_path = \'test.parquet\'\ndf.write_parquet(file_out_path)\nprint(pl.read_parquet(file_out_path))\n
Run Code Online (Sandbox Code Playgroud)\n

结果看起来非常合理:

\n
shape: (10, 1)\n\xe2\x94\x8c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x90\n\xe2\x94\x82 float_list                       \xe2\x94\x82\n\xe2\x94\x82 ---                              \xe2\x94\x82\n\xe2\x94\x82 list[f64]                        \xe2\x94\x82\n\xe2\x95\x9e\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\xa1\n\xe2\x94\x82 [0.863913, 0.831073, 0.264516]   \xe2\x94\x82\n\xe2\x94\x82 [0.51377, 0.434267, \xe2\x80\xa6 0.131684]  \xe2\x94\x82\n\xe2\x94\x82 [0.978071, 0.251396, \xe2\x80\xa6 0.142218] \xe2\x94\x82\n\xe2\x94\x82 [0.495616, 0.628793, 0.434872]   \xe2\x94\x82\n\xe2\x94\x82 \xe2\x80\xa6                                \xe2\x94\x82\n\xe2\x94\x82 [0.19035, 0.68318, \xe2\x80\xa6 0.778707]   \xe2\x94\x82\n\xe2\x94\x82 [0.103636, 0.08755, \xe2\x80\xa6 0.526014]  \xe2\x94\x82\n\xe2\x94\x82 [0.803863, …
Run Code Online (Sandbox Code Playgroud)

c++ parquet apache-arrow python-polars

3
推荐指数
1
解决办法
118
查看次数

标签 统计

apache-arrow ×1

c++ ×1

parquet ×1

python-polars ×1