Df 0 0 8_Create Data Set From Scratch

Create data from scratch with RDataFrame.

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

Author: Danilo Piparo (CERN)
This notebook tutorial was automatically generated with ROOTBOOK-izer from the macro found in the ROOT repository on Thursday, June 24, 2021 at 07:12 AM.

In [ ]:
import ROOT

We create an empty data frame of 100 entries

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

We now fill it with random numbers

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

And we write out the dataset on disk

In [ ]:
df_1.Snapshot("randomNumbers", "df008_createDataSetFromScratch_py.root")