Logo ROOT   6.14/05
Reference Guide
df010_trivialDataSource.py
Go to the documentation of this file.
1 ## \file
2 ## \ingroup tutorial_dataframe
3 ## \notebook
4 ## This tutorial illustrates how use the RDataFrame in combination with a
5 ## RDataSource. In this case we use a TTrivialDS, which is nothing more
6 ## than a simple generator: it does not interface to any existing dataset.
7 ## The TTrivialDS has a single column, col0, which has value n for entry n.
8 ##
9 ## \macro_code
10 ##
11 ## \date September 2017
12 ## \author Danilo Piparo
13 
14 import ROOT
15 
16 # Create the data frame
17 MakeTrivialDataFrame = ROOT.RDF.MakeTrivialDataFrame
18 
19 nEvents = 128
20 
21 d_s = MakeTrivialDataFrame(nEvents)
22 
23 # Now we have a regular RDataFrame: the ingestion of data is delegated to
24 # the RDataSource. At this point everything works as before.
25 h_s = d_s.Define("x", "1./(1. + col0)").Histo1D(("h_s", "h_s", 128, 0, .6), "x")
26 
27 c = ROOT.TCanvas()
28 c.SetLogy()
29 h_s.Draw()
30 
RDataFrame MakeTrivialDataFrame(ULong64_t size, bool skipEvenEntries=false)
Definition: RTrivialDS.cxx:86