Logo ROOT   6.18/05
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
14import ROOT
15
16# Create a data frame and add two columns: one for the values and one for the weight.
17r = ROOT.ROOT.RDataFrame(256);
18rr = r.Define("v", "rdfentry_")\
19 .Define("w", "return 1./(v+1)")
20
21# Now extract the statistics, weighted, unweighted
22stats_iu = rr.Stats("v")
23stats_iw = rr.Stats("v", "w")
24
25# Now print them: they are all identical of course!
26stats_iu.Print()
27stats_iw.Print()