In using root_pandas and root_numpy, how can the elements of a vector be read in as separate columns in a DataFrame?

I’ve got a tree in a ROOT file that contains some vector variables, such as jet_pt. For jet_pt, the first element is the pT of the first jet in an event, the second element is the pT of the second jet in an event and so on. I would like to read in such values such that they become separate columns in a resulting DataFrame, such as jet_pt[0], jet_pt[1] or jet_pt_1, jet_pt_2. Currently, there seems to be a flattening process happening. How should I read in the ROOT file?

import root_pandas

df = root_pandas.read_root("data.root", "nominal", flatten = ["jet_pt"], ignore = ["truth_blah_info"])

Hi, root_pandas is a third party package, not maintained by the ROOT project. I am not sure whether the root_pandas developers hang out here. You might have more luck checking their github page for their favourite communication channel.

Cheers,
Enrico

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