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