Logo ROOT  
Reference Guide
No Matches
df000_simple.py File Reference

Detailed Description

View in nbviewer Open in SWAN
Simple RDataFrame example in Python.

This tutorial shows a minimal example of RDataFrame. It starts without input data, generates a new column x with random numbers, and finally draws a histogram for x.

import ROOT
# Create a data frame with 100 rows
rdf = ROOT.RDataFrame(100)
# Define a new column `x` that contains random numbers
rdf_x = rdf.Define("x", "gRandom->Rndm()")
# Create a histogram from `x` and draw it
h = rdf_x.Histo1D("x")
ROOT's RDataFrame offers a modern, high-level interface for analysis of data stored in TTree ,...
September 2021
Enric Tejedor (CERN)

Definition in file df000_simple.py.