Skip to content

Commit 01fcb16

Browse files
committed
parquet2root python script
new file: etc/parquet2root.py
1 parent bc05f41 commit 01fcb16

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

etc/parquet2root.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
# This script demonstrates how to convert a Parquet file to a ROOT TTree using the `parquet_to_root` function
3+
# from the `parquet_to_root` module.
4+
5+
# pip install parquet-to-root
6+
# import ROOT must work for the script to run
7+
8+
from parquet_to_root import parquet_to_root
9+
import time
10+
11+
start_time = time.time()
12+
13+
# Specify the input Parquet file and the output ROOT file
14+
parquet_file = "./input_file.parquet"
15+
16+
root_file = "./output_file.root"
17+
tree_name = "TreeName" # Name of the ROOT TTree
18+
19+
# Convert the Parquet file to a ROOT TTree
20+
parquet_to_root(parquet_file, root_file, treename=tree_name, verbose=True)
21+
22+
print(f"Conversion complete in {time.time() - start_time:.2f}s: {parquet_file} -> {root_file} with TTree name '{tree_name}'")

0 commit comments

Comments
 (0)