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

Method read_pandas

python/pyarrow/parquet/core.py:1618–1654  ·  view source on GitHub ↗

Read dataset including pandas metadata, if any. Other arguments passed through to :func:`read`, see docstring for further details. Parameters ---------- **kwargs : optional Additional options for :func:`read` Examples --------

(self, **kwargs)

Source from the content-addressed store, hash-verified

1616 return metadata
1617
1618 def read_pandas(self, **kwargs):
1619 """
1620 Read dataset including pandas metadata, if any. Other arguments passed
1621 through to :func:`read`, see docstring for further details.
1622
1623 Parameters
1624 ----------
1625 **kwargs : optional
1626 Additional options for :func:`read`
1627
1628 Examples
1629 --------
1630 Generate an example parquet file:
1631
1632 >>> import pyarrow as pa
1633 >>> import pandas as pd
1634 >>> df = pd.DataFrame({'year': [2020, 2022, 2021, 2022, 2019, 2021],
1635 ... 'n_legs': [2, 2, 4, 4, 5, 100],
1636 ... 'animal': ["Flamingo", "Parrot", "Dog", "Horse",
1637 ... "Brittle stars", "Centipede"]})
1638 >>> table = pa.Table.from_pandas(df)
1639 >>> import pyarrow.parquet as pq
1640 >>> pq.write_table(table, 'table_V2.parquet')
1641 >>> dataset = pq.ParquetDataset('table_V2.parquet')
1642
1643 Read the dataset with pandas metadata:
1644
1645 >>> dataset.read_pandas(columns=["n_legs"])
1646 pyarrow.Table
1647 n_legs: int64
1648 ----
1649 n_legs: [[2,2,4,4,5,100]]
1650
1651 >>> dataset.read_pandas(columns=["n_legs"]).schema.pandas_metadata
1652 {'index_columns': [{'kind': 'range', 'name': None, 'start': 0, ...}
1653 """
1654 return self.read(use_pandas_metadata=True, **kwargs)
1655
1656 @property
1657 def fragments(self):

Calls 1

readMethod · 0.95