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

Method schema

python/pyarrow/parquet/core.py:1513–1538  ·  view source on GitHub ↗

Schema of the Dataset. Examples -------- Generate an example dataset: >>> import pyarrow as pa >>> table = pa.table({'year': [2020, 2022, 2021, 2022, 2019, 2021], ... 'n_legs': [2, 2, 4, 4, 5, 100], ...

(self)

Source from the content-addressed store, hash-verified

1511
1512 @property
1513 def schema(self):
1514 """
1515 Schema of the Dataset.
1516
1517 Examples
1518 --------
1519 Generate an example dataset:
1520
1521 >>> import pyarrow as pa
1522 >>> table = pa.table({'year': [2020, 2022, 2021, 2022, 2019, 2021],
1523 ... 'n_legs': [2, 2, 4, 4, 5, 100],
1524 ... 'animal': ["Flamingo", "Parrot", "Dog", "Horse",
1525 ... "Brittle stars", "Centipede"]})
1526 >>> import pyarrow.parquet as pq
1527 >>> pq.write_to_dataset(table, root_path='dataset_v2_schema',
1528 ... partition_cols=['year'])
1529 >>> dataset = pq.ParquetDataset('dataset_v2_schema/')
1530
1531 Read the schema:
1532
1533 >>> dataset.schema
1534 n_legs: int64
1535 animal: string
1536 year: dictionary<values=int32, indices=int32, ordered=0>
1537 """
1538 return self._dataset.schema
1539
1540 def read(self, columns=None, use_threads=True, use_pandas_metadata=False):
1541 """

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected