Problem with RDataFrame::Fill in python


I am facing an issue calling the Fill method of an RDataFrame in python, after loading a TTree into the RDataFrame what I do is:

hist = ROOT.TH1D("h_trk_y", "", 100, -20, 20)
filled_hist = h4df.Fill(test_h, 'trk_y')

The error I get is:

TypeError: can not resolve method template call for ‘Fill’

Using Histo1D works fine on the same column but I would like to use the Fill method in order to add weights to the histogram. I have also tried to place the histogram definition inside the Fill call and got the same error.

Is there a general issue with Fill and the python bindings of RDataFrame or is there I way how I can debug this further?

Thank you in advance,


PS: I am running on the CERN SWAN with this configuration:
LGC 96python3
CC7 (gcc8)

Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided

Sorry, I have just noticed that weighted histograms can be created with Histo1D, so I can use that to quickly fix the issue. Anyway do you have an idea of why Fill is failing.

Thank you,


Hi Simone,
good that you found a solution. @etejedor might know what’s up with the template argument deduction through the python bindings (but, admittedly, that’s not the most robust side of PyROOT).


Hi Simone,
The issue you describe looks like a bug. I opened the following ticket to follow it:

The second parameter needs to be of type ColumnNames_t (aka std::vector or initializer list), but even with the small correction the example you provide fails.

@eguiraud, @etejedor,

thank you for looking into this.


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