ROOT Version: 6.36.04 Platform: macosxarm64 Compiler: Apple clang version 17.0.0 (clang-1700.0.13.3)
Python Version: 3.13.7
Hi all,
I see some unexpected behaviour when creating a NumPy arrays dictionary from a RDataFrame. It seems the same reported here, but I assume it was fixed after. Basically the boolean array from RDataFrame is returned as object dtype numpy array. The issue is seen only when the RDataFrame is created from a tree.
Minimal reproducer in python:
>>> import ROOT
>>> df = ROOT.RDataFrame(10).Define('e', 'rdfentry_').Define('b', 'rdfentry_ == 1')
>>> aa = df.AsNumpy()
>>> aa['b'].dtype
dtype('bool') # as expected
>>> df.Snapshot("temp","temp.root")
<cppyy.gbl.ROOT.RDF.RResultPtr<ROOT::RDF::RInterface<ROOT::Detail::RDF::RLoopManager,void> > object at 0x600000593a20>
## close and reopen python
>>> import ROOT
>>> df = ROOT.RDataFrame("temp","temp.root")
>>> aa = df.AsNumpy()
>>> aa['b'].dtype
dtype('O') # not expected
Thanks for reaching out to the forum! I’m not surprised that the example you show does not work because the input type of the column when you snapshot it to disk with TTree will be Bool_t :