17 .Define(
"x",
"(int)rdfentry_") \
18 .Define(
"y",
"1.f/(1.f+rdfentry_)")
25print(
"Read-out of the full RDataFrame:\n{}\n".format(npy))
34print(
"Read-out of the filtered RDataFrame:\n{}\n".format(npy2))
36npy3 = df2.AsNumpy(columns=[
"x"])
37print(
"Read-out of the filtered RDataFrame with the columns option:\n{}\n".format(npy3))
39npy4 = df2.AsNumpy(exclude=[
"x"])
40print(
"Read-out of the filtered RDataFrame with the exclude option:\n{}\n".format(npy4))
45ROOT.gInterpreter.Declare(
"""
46// Inject the C++ class CustomObject in the C++ runtime.
51// Create a function that returns such an object. This is called to fill the dataframe.
52CustomObject fill_object() {
return CustomObject(); }
55df3 = df.Define("custom_object", "fill_object()")
57print("Read-out of C++ objects:\n{}\n".format(npy5["custom_object"]))
58print("Access to all methods and data members of the C++ object:\nObject: {}\nAccess data member: custom_object.x = {}\n".format(
59 repr(npy5["custom_object"][0]), npy5[
"custom_object"][0].x))
66 print(
"Please install the pandas package to run this section of the tutorial.")
69df = pandas.DataFrame(npy5)
70print(
"Content of the ROOT.RDataFrame as pandas.DataFrame:\n{}\n".format(df))
ROOT's RDataFrame offers a high level interface for analyses of data stored in TTrees,...