4

I am trying to create a numpy histogram2d for x and y where the sizes of x and y are different. From the documentation, x and y need to have the same size, but my data and the application I have naturally needs the histogram to have different x and y dimensions

bins = 100
x = np.random.normal(3, 1, 100)
y = np.random.normal(1, 1, 150)
np.histogram2d(x, y, bins)[0]

gives me

ValueError: operands could not be broadcast together with shapes (100,) (150,) 
newmathwhodis
  • 3,209
  • 2
  • 24
  • 26

0 Answers0