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, July 06, 2020 at 11:32 AM.

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

We create an empty data frame of 100 entries

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

We now fill it with random numbers

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

And we write out the dataset on disk

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