Loading [MathJax]/extensions/tex2jax.js
ROOT
Version v6.24
Reference Guide
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
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 TTrivialDS, which is nothing more
8
## than a simple generator: it does not interface to any existing dataset.
9
## The TTrivialDS has a single column, col0, which has value n for entry n.
10
##
11
## \macro_code
12
##
13
## \date September 2017
14
## \author Danilo Piparo (CERN)
15
16
import
ROOT
17
18
# Create the data frame
19
MakeTrivialDataFrame = ROOT.RDF.MakeTrivialDataFrame
20
21
nEvents = 128
22
23
d_s = MakeTrivialDataFrame(nEvents)
24
25
# Now we have a regular RDataFrame: the ingestion of data is delegated to
26
# the RDataSource. At this point everything works as before.
27
h_s = d_s.Define(
"x"
,
"1./(1. + col0)"
).Histo1D((
"h_s"
,
"h_s"
, 128, 0, .6),
"x"
)
28
29
c = ROOT.TCanvas()
30
c.SetLogy()
31
h_s.Draw()
32
c.SaveAs(
"df010_trivialDataSource.png"
)
33
34
print(
"Saved figure to df010_trivialDataSource.png"
)
tutorials
dataframe
df010_trivialDataSource.py
ROOT v6-24 - Reference Guide Generated on Tue Aug 22 2023 03:06:57 (GVA Time) using Doxygen 1.9.8