Skip to main content

Polars plugin for reading CERN's ROOT file format

Project description

Polars ROOT

Polars plugin for reading CERN's ROOT file format. Uses Uproot and Awkward Arrays under the hood.

Installation

polars-root supports Python 3.10 and later. To install for use with standard polars, run:

pip install 'polars-root[standard]'

To install for use with polars-u64-idx, run:

pip install 'polars-root[u64-idx]'

Usage

import polars as pl
import polars_root as pr

# Read TTree `tree_name` from a ROOT file into a Polars DataFrame
df = pr.read_root("example.root", "tree_name")

# Read TTree `tree_name` from a ROOT file into a Polars LazyFrame
lf = pr.scan_root("example.root", "tree_name")

# Load TTree `tree_name` from a ROOT file into a LazyFrame, perform some operations, and then sink to parquet
(
    pr.scan_root("example.root", "tree_name")
    .filter(pl.col("some_column") > 0)
    .select(["some_column", "another_column"])
    .sink_parquet("output.parquet")
)

# Also supports opening a ROOT file and jumping straight to a TTree using a colon, as in Uproot:
df = pr.read_root("example.root:tree_name")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

polars_root-0.2.0.tar.gz (76.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

polars_root-0.2.0-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file polars_root-0.2.0.tar.gz.

File metadata

  • Download URL: polars_root-0.2.0.tar.gz
  • Upload date:
  • Size: 76.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.2

File hashes

Hashes for polars_root-0.2.0.tar.gz
Algorithm Hash digest
SHA256 a52c99a6c2283745dc0e02d13ba1788c85e64ad6bda059cafe461591118dbf44
MD5 8b38816c99fd400d3d4b5150189231ea
BLAKE2b-256 f538ab9cd7b63dc2b28c7dc8400db914547fcc2abb5bd1beef7dc6289c005a4d

See more details on using hashes here.

File details

Details for the file polars_root-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for polars_root-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5697ecdabc672d3765bb93d024ec6412f019e65bf42763999f879c345c9998de
MD5 74393ffd365a7cc7b27e83ded89cca64
BLAKE2b-256 1728577b0ba4977b4a3740a77a6991f24d0d62096dfb59529c3eada947a51ba0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page