Df 0 0 8_Create Data Set From Scratch

This tutorial shows how to create a dataset from scratch with RDataFrame

Author: Danilo Piparo
This notebook tutorial was automatically generated with ROOTBOOK-izer from the macro found in the ROOT repository on Monday, January 27, 2020 at 01:06 AM.

In [1]:
import ROOT
Welcome to JupyROOT 6.19/01

We create an empty data frame of 100 entries

In [2]:
tdf = ROOT.ROOT.RDataFrame(100)

We now fill it with random numbers

In [3]:
ROOT.gRandom.SetSeed(1)
tdf_1 = tdf.Define("rnd", "gRandom->Gaus()")

And we write out the dataset on disk

In [4]:
tdf_1.Snapshot("randomNumbers", "df008_createDataSetFromScratch_py.root")
Out[4]:
<ROOT.ROOT::RDF::RResultPtr<ROOT::RDF::RInterface<ROOT::Detail::RDF::RLoopManager,void> > object at 0x555fd7dab060>