ROOT
v6-22
Reference Guide
df031_Stats.py
Go to the documentation of this file.
1
## \file
2
## \ingroup tutorial_dataframe
3
## \notebook
4
##
5
## Extract the statistics relative to RDataFrame columns and store them
6
## in TStatistic instances.
7
##
8
## \macro_code
9
## \macro_output
10
##
11
## \date April 2019
12
## \author Danilo Piparo
13
14
import
ROOT
15
16
# Create a data frame and add two columns: one for the values and one for the weight.
17
r =
ROOT.RDataFrame
(256);
18
rr = r.Define(
"v"
,
"rdfentry_"
)\
19
.Define(
"w"
,
"return 1./(v+1)"
)
20
21
# Now extract the statistics, weighted, unweighted
22
stats_iu = rr.Stats(
"v"
)
23
stats_iw = rr.Stats(
"v"
,
"w"
)
24
25
# Now print them: they are all identical of course!
26
stats_iu.Print()
27
stats_iw.Print()
ROOT::RDataFrame
ROOT's RDataFrame offers a high level interface for analyses of data stored in TTrees,...
Definition:
RDataFrame.hxx:42
tutorials
dataframe
df031_Stats.py
ROOT v6-22 - Reference Guide Generated on Fri Apr 1 2022 11:53:17 (GVA Time) using Doxygen 1.9.4