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
.
Author: Enric Tejedor (CERN)
This notebook tutorial was automatically generated with ROOTBOOK-izer from the macro found in the ROOT repository on Tuesday, March 19, 2024 at 07:06 PM.
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")
h.Draw()
Info in <TCanvas::MakeDefCanvas>: created default TCanvas with name c1
Draw all canvases
from ROOT import gROOT
gROOT.GetListOfCanvases().Draw()