pyarrow-python
Use for writing, reviewing, debugging, testing, or optimizing Python code that uses PyArrow arrays, schemas, Tables, RecordBatches, RecordBatchReaders…
by skillmds★ 42 GitHub stars
Install pyarrow-python in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
About this skill
PyArrow Python
Produce schema-explicit columnar code whose logical object, batch boundary, null behavior, memory lifetime, and materialization point are deliberate.
Boundary
Use this skill when the implementation directly uses pyarrow or must expose an
Arrow-compatible boundary. Do not introduce PyArrow merely to perform a small
Python-list or pandas transformation. Keep storage-format questions in scope
only when PyArrow reads or writes them. Arrow Flight servers, Acero internals,
and non-Python implementations require their own guidance.
Classify the object first
| Object | Meaning | Use it for |
|---|---|---|
DataType / Field / Schema |
Immutable type and named-field contracts, including nullability and metadata. | Pinning a boundary before constructing or scanning data. |
Scalar |
One typed value, possibly null. | Kernel arguments and scalar results. |
Array |
One contiguous typed column backed by buffers. | A single physical column segment. |
ChunkedArray |
One logical column made of zero or more same-typed arrays. | Table columns and multi-source results; chunk count is not row count. |
RecordBatch |
Equal-length arrays under one schema. | Bounded transport or processing batches. |
Table |
A logical table whose columns may be chunked. | Materialized tabular results that fit the required memory boundary. |
RecordBatchReader |
A schema plus a consumable stream of batches. | Streaming interchange when the consumer can process batches once. |
Dataset |
A logical collection of fragments with a unified schema. | Discovering and querying multi-file or partitioned data. |
Scanner |
A dataset scan with projection, filter, and batching options bound. | Deferred dataset execution and bounded batch iteration. |
Arrays and schemas are immutable. A Table is materialized but may be
physically chunked; combine_chunks() can allocate and is not routine cleanup.
A Dataset describes sources, while a Scanner describes the read. Calling
to_table() materializes all selected rows; to_batches() preserves a batch
boundary. Read the object and memory model when
chunking, buffers, ownership, dictionaries, nested types, or zero-copy claims
matter.
Ordered workflow
- Recover the boundary contract: input object, output object, schema, field nullability, row order if required, batch size, and ownership lifetime.
- Choose
Array,RecordBatch,Table,RecordBatchReader,Dataset, orScannerfrom that contract; do not default every job toTable. - Pin types where empty input, identifiers, timestamps, decimals, nested data, dictionary encoding, or cross-language interchange make inference unsafe.
- Push dataset projection and predicates into the scan. Materialize only at a consumer that requires all rows.
- Use
pyarrow.computekernels for Arrow data. Do not convert to Python rows or pandas solely to perform a supported kernel operation. - Test schema equality separately from value equality, and include empty, null, multi-chunk, and multi-batch inputs.
- Inspect the installed API before using a drifting option or claiming a zero-copy, pushdown, or memory property.
Choose by required result
| Required result | Use | Critical condition |
|---|---|---|
| One typed column | pa.array(..., type=...) |
Conversion and null policy are explicit. |
| One bounded set of equal-length columns | pa.record_batch(..., schema=...) |
All arrays conform to the same schema and length. |
| One logical materialized table | pa.table(..., schema=...) |
Total selected result fits the boundary. |
| Consumable batches with a common schema | RecordBatchReader |
The consumer accepts a one-pass stream. |
| Multi-file discovery and pruning | pyarrow.dataset.dataset |
Format, filesystem, partitioning, and schema are known or inspected. |
| Deferred filtered/projected scan | dataset.scanner(...) |
Use dataset expressions such as ds.field, not eager masks. |
| Elementwise, vector, aggregate, or selection work | pyarrow.compute |
Choose kernel null semantics and checked/safe behavior deliberately. |
| Portable Arrow stream/file serialization | pyarrow.ipc |
Choose stream for sequential batches, file for random-access footer metadata. |
| Analytical columnar storage | Parquet APIs or Dataset writer | Schema, partition layout, row groups, overwrite policy, and reader compatibility are explicit. |
Read the operation map before choosing construction, compute, dataset, serialization, or conversion APIs.
Canonical typed scan
from collections.abc import Iterator
from pathlib import Path
import pyarrow as pa
import pyarrow.dataset as ds
ORDER_SCHEMA = pa.schema(
[
pa.field("order_id", pa.uint64(), nullable=False),
pa.field("country", pa.string(), nullable=False),
pa.field("amount", pa.decimal128(18, 2), nullable=True),
]
)
def scan_order
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
Bundled files
- references/object-model.md
- references/operations.md
- references/testing.md
- references/version-grounding.md
- scripts/inspect_pyarrow.py
FAQ
What does the pyarrow-python skill do?
Use for writing, reviewing, debugging, testing, or optimizing Python code that uses PyArrow arrays, schemas, Tables, RecordBatches, RecordBatchReaders, compute kernels, Dataset scans, Parquet, or Arrow IPC and C data interfaces. Trigger on schema drift, null/type semantics, chunking, batch streaming, predicate projection pushdown, conversion, and memory ownership. Do not use for pandas-only transformations, Polars-only expressions, generic SQL, Arrow Flight service design, C++/Rust Arrow, or Parquet work that does not use PyArrow.
How do I install the pyarrow-python skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the pyarrow-python skill run scripts?
Yes, this skill bundles executable scripts. Review the source before installing.
Related skills
skill-creator
AnthropicCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
discernment-nudge
AnthropicAfter you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
data-consolidate
AnthropicJoins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
inspection-to-capa
AnthropicRuns the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…