Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
df031_Stats.C 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.

void df031_Stats() {
// Create a data frame and add two columns: one for the values and one for the weight.
auto rr = r.Define("v", [](ULong64_t e){return e;}, {"rdfentry_"})
.Define("w", [](ULong64_t e){return 1./(e+1);}, {"v"});
// Now extract the statistics, weighted, unweighted - with and without explicit types.
auto stats_eu = rr.Stats<ULong64_t>("v");
auto stats_ew = rr.Stats<ULong64_t, double>("v", "w");
auto stats_iu = rr.Stats("v");
auto stats_iw = rr.Stats("v", "w");
// Now print them: they are all identical of course!
stats_eu->Print();
stats_ew->Print();
stats_iu->Print();
stats_iw->Print();
}
#define e(i)
Definition RSha256.hxx:103
unsigned long long ULong64_t
Definition RtypesCore.h:81
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
ROOT's RDataFrame offers a modern, high-level interface for analysis of data stored in TTree ,...
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
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
Date
April 2019
Author
Danilo Piparo (CERN)

Definition in file df031_Stats.C.