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

时间:2015-05-13 23:17:33

标签: statistics histogram histogram2d

我正在尝试为x和y创建一个numpy histogram2d,其中x和y的大小不同。从文档中,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,) 

0 个答案:

没有答案
相关问题