Logo ROOT  
Reference Guide
df031_Stats.py File Reference



Detailed Description

View in nbviewer Open in SWAN Use the Stats action to extract the statistics of a column.

Extract the statistics relative to RDataFrame columns and store them in TStatistic instances.

import ROOT
# Create a data frame and add two columns: one for the values and one for the weight.
r = ROOT.RDataFrame(256);
rr = r.Define("v", "rdfentry_")\
.Define("w", "return 1./(v+1)")
# Now extract the statistics, weighted, unweighted
stats_iu = rr.Stats("v")
stats_iw = rr.Stats("v", "w")
# Now print them: they are all identical of course!
OBJ: TStatistic Mean = 127.5 +- 4.628 RMS = 74.045 Count = 256 Min = 0 Max = 255
OBJ: TStatistic Mean = 40.8 +- 12.86 RMS = 60.318 Count = 256 Min = 0 Max = 255
April 2019
Danilo Piparo (CERN)

Definition in file df031_Stats.py.

ROOT's RDataFrame offers a high level interface for analyses of data stored in TTree,...
Definition: RDataFrame.hxx:42