ROOT RDataFrame does not has AsNumpy()

Dear experts,

I am runing RDataFrame and plan to convert the RDataFrame into array in Numpy. However I ran into error with AsNumpy() and I am using ROOT 6.16/00

The code I am running is this example:

Traceback (most recent call last):
File “”, line 12, in
npy = df.AsNumpy()
AttributeError: ‘RInterfaceROOT::Detail::RDF::RLoopManager,void’ object has no attribute ‘AsNumpy’

Please read tips for efficient and successful posting and posting code

_ROOT Version: 6.16/00
_Platform: MacOC 10.14.14

Hi @tahuang1991,
the docs you linked to are for ROOT master. You should see exploring the reference guides for different ROOT versions that the AsNumpy tutorial is not present in v6.16, because the feature was introduced in ROOT v6.18.


Hi Enrico,

Now I upgraded the Mac OS to 10.15.5 and ROOT to v6.20.04. The df_numpy() is working fine for me. However, when I was trying the scripts for RDataFrame under tutorial, i ran into trouble again.

>>> Extract the training and testing events for signal from the SMHiggsToZZTo4L.root dataset.
Traceback (most recent call last):
  File "", line 60, in <module>
    .Snapshot("Events", "train_" + label + ".root", columns)
TypeError: can not resolve method template call for 'Snapshot'

I am not sure why is not working. I also checked out the ntuples used in script to my local directory.



Do you know which PyROOT version you use? You can most easily check by trying to create a std::vector in python via ROOT.std.vector['float'](). The “old” PyROOT should complain and say AttributeError: Template instance has no attribute '__getitem__'. In the meanwhile I try to reproduce the problem!


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