How to get bin content of all bins along x and y axis of a 2D histograms in python uproot

I would like to write a uproot script in python to get the bin content in all bins(boxes) in a 2D histogram and add it to a vector and then print it to a .txt file with bin size on x and y axis as first line and then bin content value line-by-line i.e. rows and then columns.

Is this possible to do with uproot package on python function that takes the root file and the histogram name as input.

Essentially, I would like to know how to get bin content of all bins along x and y axis of a 2D histograms. What functions to use in uproot ?

Hi @elemental!

uproot is not part of ROOT, but a separate package that re-implements ROOT IO. Therefore you need to ask for help somewhere else, since this is the support forum for CERN’s ROOT.

1 Like