Extract information from a ROOT tree without using for loop

I refer to extract_info where I extracted information by using a for loop. Is there a way to extract information without reading entry by entry in a for loop? for example reading the data as a matrix?


You could try with RDataFrame (documentation, tutorials).


Thanks for your answer. I solved this problem by using uproot. I found it very useful to manage arrays to create dataframe with pandas. Here, the function in python that I wrote:

def read_root_to_df (fname, treename="treename"):

    # read file, get tree and list of branches

    # fill dict. with array from branches
    df_values = {}
    for col in col_list:

    # Create the dataframe.
    df = pd.DataFrame.from_dict(df_values)
    return df

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.