MCPcopy Create free account
hub / github.com/apache/arrow / read_row_groups

Method read_row_groups

python/pyarrow/parquet/core.py:492–538  ·  view source on GitHub ↗

Read a multiple row groups from a Parquet file. Parameters ---------- row_groups : list Only these row groups will be read from the file. columns : list If not None, only these columns will be read from the row group. A co

(self, row_groups, columns=None, use_threads=True,
                        use_pandas_metadata=False)

Source from the content-addressed store, hash-verified

490 use_threads=use_threads)
491
492 def read_row_groups(self, row_groups, columns=None, use_threads=True,
493 use_pandas_metadata=False):
494 """
495 Read a multiple row groups from a Parquet file.
496
497 Parameters
498 ----------
499 row_groups : list
500 Only these row groups will be read from the file.
501 columns : list
502 If not None, only these columns will be read from the row group. A
503 column name may be a prefix of a nested field, e.g. 'a' will select
504 'a.b', 'a.c', and 'a.d.e'.
505 use_threads : bool, default True
506 Perform multi-threaded column reads.
507 use_pandas_metadata : bool, default False
508 If True and file has custom pandas schema metadata, ensure that
509 index columns are also loaded.
510
511 Returns
512 -------
513 pyarrow.table.Table
514 Content of the row groups as a table (of columns).
515
516 Examples
517 --------
518 >>> import pyarrow as pa
519 >>> table = pa.table({'n_legs': [2, 2, 4, 4, 5, 100],
520 ... 'animal': ["Flamingo", "Parrot", "Dog", "Horse",
521 ... "Brittle stars", "Centipede"]})
522 >>> import pyarrow.parquet as pq
523 >>> pq.write_table(table, 'example.parquet')
524 >>> parquet_file = pq.ParquetFile('example.parquet')
525
526 >>> parquet_file.read_row_groups([0,0])
527 pyarrow.Table
528 n_legs: int64
529 animal: string
530 ----
531 n_legs: [[2,2,4,4,5,...,2,4,4,5,100]]
532 animal: [["Flamingo","Parrot","Dog",...,"Brittle stars","Centipede"]]
533 """
534 column_indices = self._get_column_indices(
535 columns, use_pandas_metadata=use_pandas_metadata)
536 return self.reader.read_row_groups(row_groups,
537 column_indices=column_indices,
538 use_threads=use_threads)
539
540 def iter_batches(self, batch_size=65536, row_groups=None, columns=None,
541 use_threads=True, use_pandas_metadata=False):

Calls 1

_get_column_indicesMethod · 0.95