import ROOT
from sys import exit
 
         .Define("x", "(int)rdfentry_") \
         .Define("y", "1.f/(1.f+rdfentry_)")
 
print(
"Read-out of the full RDataFrame:\n{}\n".
format(npy))
 
print(
"Read-out of the filtered RDataFrame:\n{}\n".
format(npy2))
 
print(
"Read-out of the filtered RDataFrame with the columns option:\n{}\n".
format(npy3))
 
print(
"Read-out of the filtered RDataFrame with the exclude option:\n{}\n".
format(npy4))
 
// Inject the C++ class CustomObject in the C++ runtime.
class CustomObject {
public:
    int x = 42;
};
// Create a function that returns such an object. This is called to fill the dataframe.
CustomObject fill_object() { return CustomObject(); }
""")
 
df3 = 
df.Define(
"custom_object", 
"fill_object()")
print(
"Read-out of C++ objects:\n{}\n".
format(npy5[
"custom_object"]))
print(
"Access to all methods and data members of the C++ object:\nObject: {}\nAccess data member: custom_object.x = {}\n".
format(
    repr(npy5[
"custom_object"][0]), npy5[
"custom_object"][0].x))
 
 
try:
    import pandas
except:
    print("Please install the pandas package to run this section of the tutorial.")
 
print(
"Content of the ROOT.RDataFrame as pandas.DataFrame:\n{}\n".
format(df))
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
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 Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t format
ROOT's RDataFrame offers a modern, high-level interface for analysis of data stored in TTree ,...
Read-out of the full RDataFrame:
{'x': ndarray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], dtype=int32), 'y': ndarray([1.        , 0.5       , 0.33333334, 0.25      , 0.2       ,
         0.16666667, 0.14285715, 0.125     , 0.11111111, 0.1       ],
        dtype=float32)}
 
Read-out of the filtered RDataFrame:
{'x': ndarray([6, 7, 8, 9], dtype=int32), 'y': ndarray([0.14285715, 0.125     , 0.11111111, 0.1       ], dtype=float32)}
 
Read-out of the filtered RDataFrame with the columns option:
{'x': ndarray([6, 7, 8, 9], dtype=int32)}
 
Read-out of the filtered RDataFrame with the exclude option:
{'y': ndarray([0.14285715, 0.125     , 0.11111111, 0.1       ], dtype=float32)}
 
Read-out of C++ objects:
[<cppyy.gbl.CustomObject object at 0x556a39000ca0>
 <cppyy.gbl.CustomObject object at 0x556a39000ca4>
 <cppyy.gbl.CustomObject object at 0x556a39000ca8>
 <cppyy.gbl.CustomObject object at 0x556a39000cac>
 <cppyy.gbl.CustomObject object at 0x556a39000cb0>
 <cppyy.gbl.CustomObject object at 0x556a39000cb4>
 <cppyy.gbl.CustomObject object at 0x556a39000cb8>
 <cppyy.gbl.CustomObject object at 0x556a39000cbc>
 <cppyy.gbl.CustomObject object at 0x556a39000cc0>
 <cppyy.gbl.CustomObject object at 0x556a39000cc4>]
 
Access to all methods and data members of the C++ object:
Object: <cppyy.gbl.CustomObject object at 0x556a39000ca0>
Access data member: custom_object.x = 42
 
Content of the ROOT.RDataFrame as pandas.DataFrame:
                                       custom_object  x         y
0  <cppyy.gbl.CustomObject object at 0x556a39000ca0>  0  1.000000
1  <cppyy.gbl.CustomObject object at 0x556a39000ca4>  1  0.500000
2  <cppyy.gbl.CustomObject object at 0x556a39000ca8>  2  0.333333
3  <cppyy.gbl.CustomObject object at 0x556a39000cac>  3  0.250000
4  <cppyy.gbl.CustomObject object at 0x556a39000cb0>  4  0.200000
5  <cppyy.gbl.CustomObject object at 0x556a39000cb4>  5  0.166667
6  <cppyy.gbl.CustomObject object at 0x556a39000cb8>  6  0.142857
7  <cppyy.gbl.CustomObject object at 0x556a39000cbc>  7  0.125000
8  <cppyy.gbl.CustomObject object at 0x556a39000cc0>  8  0.111111
9  <cppyy.gbl.CustomObject object at 0x556a39000cc4>  9  0.100000