Statistics 如何创建两个不同长度数组的histogram2d?

Statistics 如何创建两个不同长度数组的histogram2d?,statistics,histogram,histogram2d,Statistics,Histogram,Histogram2d,我正在尝试为x和y创建一个大小不同的numpy Historogram2D。从文档中可以看出,x和y需要具有相同的大小,但我的数据和应用程序自然需要直方图具有不同的x和y维度 bins = 100 x = np.random.normal(3, 1, 100) y = np.random.normal(1, 1, 150) np.histogram2d(x, y, bins)[0] 给我 ValueError: operands could not be broadcast together

我正在尝试为x和y创建一个大小不同的numpy Historogram2D。从文档中可以看出,x和y需要具有相同的大小,但我的数据和应用程序自然需要直方图具有不同的x和y维度

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

ValueError: operands could not be broadcast together with shapes (100,) (150,)