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

Method read

python/pyarrow/parquet/core.py:596–640  ·  view source on GitHub ↗

Read a Table from Parquet format. Parameters ---------- columns : list If not None, only these columns will be read from the file. A column name may be a prefix of a nested field, e.g. 'a' will select 'a.b', 'a.c', and 'a.d.e'.

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

Source from the content-addressed store, hash-verified

594 return batches
595
596 def read(self, columns=None, use_threads=True, use_pandas_metadata=False):
597 """
598 Read a Table from Parquet format.
599
600 Parameters
601 ----------
602 columns : list
603 If not None, only these columns will be read from the file. A
604 column name may be a prefix of a nested field, e.g. 'a' will select
605 'a.b', 'a.c', and 'a.d.e'.
606 use_threads : bool, default True
607 Perform multi-threaded column reads.
608 use_pandas_metadata : bool, default False
609 If True and file has custom pandas schema metadata, ensure that
610 index columns are also loaded.
611
612 Returns
613 -------
614 pyarrow.table.Table
615 Content of the file as a table (of columns).
616
617 Examples
618 --------
619 Generate an example Parquet file:
620
621 >>> import pyarrow as pa
622 >>> table = pa.table({'n_legs': [2, 2, 4, 4, 5, 100],
623 ... 'animal': ["Flamingo", "Parrot", "Dog", "Horse",
624 ... "Brittle stars", "Centipede"]})
625 >>> import pyarrow.parquet as pq
626 >>> pq.write_table(table, 'example.parquet')
627 >>> parquet_file = pq.ParquetFile('example.parquet')
628
629 Read a Table:
630
631 >>> parquet_file.read(columns=["animal"])
632 pyarrow.Table
633 animal: string
634 ----
635 animal: [["Flamingo","Parrot",...,"Brittle stars","Centipede"]]
636 """
637 column_indices = self._get_column_indices(
638 columns, use_pandas_metadata=use_pandas_metadata)
639 return self.reader.read_all(column_indices=column_indices,
640 use_threads=use_threads)
641
642 def scan_contents(self, columns=None, batch_size=65536):
643 """

Calls 1

_get_column_indicesMethod · 0.95