Hi,
this topic is related to this one: Make RDataFrames interoperable with other Python tools
I want to do the following:
- Apply some cuts to the RDataFrame
- Convert select columns to numpy format and run inference on them
- Attach the inference result (1D numpy array) as a new column to RDataFrame
I tried adapting the approach in the linked thread.
def add_to_df(analyzer,prediction,column_name):
@ROOT.Numba.Declare(["int"], "float")
def get_prediction(index):
return prediction[index]
analyzer.Define(column_name, "Numba::get_prediction(rdfentry_)")
The problem is that the rdfentry_
, as far as I can tell, corresponds to the original row index, i.e. before applying any cuts to the DataFrame. However, I need to update the indices to run from 0 to N_post_cut
applying the cuts. Is there any way around it? Thanks
Cheers,
Matej
ROOT Version: 6.26.11
Platform: linuxx8664gcc
Compiler: g++ (GCC) 11.4.1