Concatenate RDataframe

Hello, is there any features to concatenate two RDataframe (as pandas concatenate)?

This is my problem. I have a TTree with a branch called weight. I have to use this variables, but after dividing it by the sum of all the weight in the TTree. This is easily doable. The problem is that I have to use several input TTrees (from different files) and for each of them I have to consider the value of weight divided by the sum of the weight, where the sum of the weights is computed for each file (actually a bit more complicated since it is for group of files).

My workflow with pandas (via uproot) is:

  • load all the TTrees in different dataframes
  • for each TTree compute the sum of weights
  • add a new column, equal to the weight column divided by the sum
  • concatenate all the dataframes

Hi Ruggero,
I’m afraid RDataFrames do not concatenate.

I think the ROOT way would be to write friend trees with the computed weights/sum_of_weights per tree, and then add those trees as friends when you process everything together in a second step. Make sure to do this step in a single-thread or the output entries will be reshuffled w.r.t. to the input entries.

Cheers,
Enrico

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