ROOT
6.30.04
Reference Guide
All
Namespaces
Files
Pages
df024_Display.py
Go to the documentation of this file.
1
## \file
2
## \ingroup tutorial_dataframe
3
## \notebook
4
## This tutorial shows how to use the Display action
5
##
6
## \macro_code
7
## \macro_output
8
##
9
## \date August 2018
10
## \author Enrico Guiraud, Danilo Piparo, Enric Tejedor Saavedra CERN, Massimo Tumolo Politecnico di Torino
11
12
import
ROOT
13
14
# Setting up a Dataframe with some data
15
ROOT.gInterpreter.ProcessLine(
'''
16
unsigned long long y = 1;
17
int x = 1;
18
double w = 1;
19
double z = 1;
20
ROOT::RDataFrame tdf(10);
21
auto d = tdf.Define("y", [&y]() { return y *= 100; }) // A column with ulongs
22
.Define("x",
23
[&x]() {
24
return std::vector<int>({x++, x++, x++, x++});
25
}) // A column with four-elements collection
26
.Define("w", [&w]() { return w *= 1.8; }) // A column with doubles
27
.Define("z", [&z]() {
28
z *= 1.1;
29
return std::vector<std::vector<double>>({{z, ++z}, {z, ++z}, {z, ++z}});
30
}); // A column of matrices
31
'''
)
32
33
d = ROOT.d
34
35
# Preparing the RResultPtr<RDisplay> object with all columns and default number of entries
36
d1 = d.Display(
""
)
37
# Preparing the RResultPtr<RDisplay> object with two columns and default number of entries
38
cols = ROOT.vector(
'string'
)(); cols.push_back(
"x"
); cols.push_back(
"y"
);
39
d2 = d.Display(cols)
40
41
# Printing the short representations, the event loop will run
42
print(
"The following is the representation of all columns with the default nr of entries"
)
43
d1.Print()
44
print(
"\n\nThe following is the representation of two columns with the default nr of entries"
)
45
d2.Print()
tutorials
dataframe
df024_Display.py
Generated on Tue May 5 2020 14:03:41 for ROOT by
1.8.5