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
Release history Release notifications | RSS feed
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)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a52c99a6c2283745dc0e02d13ba1788c85e64ad6bda059cafe461591118dbf44
|
|
| MD5 |
8b38816c99fd400d3d4b5150189231ea
|
|
| BLAKE2b-256 |
f538ab9cd7b63dc2b28c7dc8400db914547fcc2abb5bd1beef7dc6289c005a4d
|
File details
Details for the file polars_root-0.2.0-py3-none-any.whl.
File metadata
- Download URL: polars_root-0.2.0-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5697ecdabc672d3765bb93d024ec6412f019e65bf42763999f879c345c9998de
|
|
| MD5 |
74393ffd365a7cc7b27e83ded89cca64
|
|
| BLAKE2b-256 |
1728577b0ba4977b4a3740a77a6991f24d0d62096dfb59529c3eada947a51ba0
|