Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/multithreading/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 使用拼花地板文件统计信息而不读取文件_Python_Parquet_Dask_Pyarrow_Fastparquet - Fatal编程技术网

Python 使用拼花地板文件统计信息而不读取文件

Python 使用拼花地板文件统计信息而不读取文件,python,parquet,dask,pyarrow,fastparquet,Python,Parquet,Dask,Pyarrow,Fastparquet,据我所知,拼花地板文件具有列的最小/最大统计信息。 我的问题是,如何使用python读取这些统计数据而不读取整个文件 如果有帮助,我还有\u common\u metadata和\u metadata文件 我的具体问题是获取此文件系统中每个证券交易所分区的最大日期(每个年度分区包含多个具有日期列的拼花地板文件): 经过一些额外的搜索,我在fastparquet模块中找到了这个 它给出每个文件的分钟和最大值 例如: >>> import fastparquet >>

据我所知,拼花地板文件具有列的最小/最大统计信息。 我的问题是,如何使用python读取这些统计数据而不读取整个文件

如果有帮助,我还有
\u common\u metadata
\u metadata
文件


我的具体问题是获取此文件系统中每个证券交易所分区的最大日期(每个年度分区包含多个具有日期列的拼花地板文件):


经过一些额外的搜索,我在
fastparquet
模块中找到了这个

它给出每个文件的分钟和最大值

例如:

>>> import fastparquet
>>> fastparquet.api.sorted_partitioned_columns(pf)
{'id': {'min': [1, 5, 10], 'max': [4, 9, 20]}}

经过一些额外的搜索,我在
fastparquet
模块中找到了这个

它给出每个文件的分钟和最大值

例如:

>>> import fastparquet
>>> fastparquet.api.sorted_partitioned_columns(pf)
{'id': {'min': [1, 5, 10], 'max': [4, 9, 20]}}

您可以在
pyarrow
中按行组提取它们:

import pyarrow.parquet as pq

pq_file = pq.ParquetFile(…)
# Get metadata for the i-th RowGroup
rg_meta = pq_file.metadata.row_group(i)
# Get the "max" statistic for the k-th column
max_of_col = rq_meta.column(col).statistics.max

您可以在
pyarrow
中按行组提取它们:

import pyarrow.parquet as pq

pq_file = pq.ParquetFile(…)
# Get metadata for the i-th RowGroup
rg_meta = pq_file.metadata.row_group(i)
# Get the "max" statistic for the k-th column
max_of_col = rq_meta.column(col).statistics.max

pq.ParquetFile(…)
中的
是文件或目录的路径?如果是一个文件,你说的“第i行组”是什么意思?我认为行组是每个文件的。不,文件可以有任意数量的行组。此命令仅适用于单个文件。对于多个文件,使用
ParquetDataset
,然后迭代其所有
ParquetDatasetPiece
s。因此,如果需要每个文件的所有最大值的最大日期,我应该
max
?是的,这将为您提供全局最大值。如何从
pq.ParquetFile中的rg.statistics.maxtthe
返回的int中获取日期(…)
是文件的路径还是目录?如果是文件,“第i行组”是什么意思?我认为行组是每个文件的行组否,文件可以有任意数量的行组。此命令仅适用于单个文件。对于多个文件,使用
ParquetDataset
,然后迭代其所有
ParquetDatasetPiece
s。因此,如果想要最大日期,我应该
max
每个文件的所有最大值?是的,这将给出u全局最大值。如何从rg.statistics.max返回的int中获取日期