For that it’s enough to go through a dictionary of numpy arrays and use MakeNumpyDataFrame
, see e.g. Saving pandas dataframe as TTree with RDataframe - #2 by swunsch .
It works as long as data is flat (one value per cell):
arr_dict = {c: np.array(pandas_df[c]) for c in pandas_df}
root_df = ROOT.RDF.MakeNumpyDataFrame(arr_dict)