I\'m trying to create a weighted histogram using the following code. However, when I run the code, I get the error:
RuntimeWarning: invalid value encountered in t