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