ROOT
master
Reference Guide
Loading...
Searching...
No Matches
df010_trivialDataSource.py
Go to the documentation of this file.
1
## \file
2
## \ingroup tutorial_dataframe
3
## \notebook -draw
4
## Use the "trivial data source", an example data source implementation.
5
##
6
## This tutorial illustrates how use the RDataFrame in combination with a
7
## RDataSource. In this case we use a RTrivialDS, which is nothing more
8
## than a simple generator: it does not interface to any existing dataset.
9
## The RTrivialDS has a single column, col0, which has value n for entry n.
10
##
11
## Note that RTrivialDS is only a demo data source implementation and superior alternatives
12
## typically exist for production use (e.g. constructing an empty RDataFrame as `RDataFrame(nEntries)`).
13
##
14
## \macro_image
15
## \macro_code
16
##
17
## \date September 2017
18
## \author Danilo Piparo (CERN)
19
20
import
ROOT
21
22
# Create the data frame
23
MakeTrivialDataFrame =
ROOT.RDF.MakeTrivialDataFrame
24
25
nEvents = 128
26
27
d_s = MakeTrivialDataFrame(nEvents)
28
29
# Now we have a regular RDataFrame: the ingestion of data is delegated to
30
# the RDataSource. At this point everything works as before.
31
h_s =
d_s.Define
(
"x"
,
"1./(1. + col0)"
).Histo1D((
"h_s"
,
"h_s"
, 128, 0, .6),
"x"
)
32
33
c =
ROOT.TCanvas
()
34
c.SetLogy
()
35
h_s.Draw
()
36
c.SaveAs
(
"df010_trivialDataSource.png"
)
37
38
print(
"Saved figure to df010_trivialDataSource.png"
)
TRangeDynCast
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Definition
TCollection.h:359
tutorials
analysis
dataframe
df010_trivialDataSource.py
ROOTmaster - Reference Guide Generated on Tue Jul 14 2026 15:19:05 (GVA Time) using Doxygen 1.10.0