Rebin 2d histogram

Hi all.

How can I rebin a 2d histogram with bins given in arrays, i.e. I want to rebin
a histogram according to xbins = [0, 10, 20, 35, 40] and ybins = [0, 1, 2, 2.5] for example,
unequal spacing.

Thank you and regards,
heico

so all entries above 2.5 will be lost ?

yes.