I am using numpy histogram2d to compute the values for the visual representation of a 2d histogram of two variables:
H, xedges, yedges = np.histogram2d(Z[:,0], Z[:,1], bins=100)
where Z is a numpy matrix
The error that I'm getting is:
Traceback (most recent call last):
File "/home/.../pca_analysis.py", line 141, in <module>
H, xedges, yedges = np.histogram2d(Z[:,0], Z[:,1], bins=100)
File "/usr/lib/python2.7/dist-packages/numpy/lib/twodim_base.py", line 615, in histogram2d
hist, edges = histogramdd([x,y], bins, range, normed, weights)
File "/usr/lib/python2.7/dist-packages/numpy/lib/function_base.py", line 281, in histogramdd
N, D = sample.shape
ValueError: too many values to unpack
I cannot really understand why I am getting this error. I have tried using the histogram2d function with random values and it is working properly. I have also tried to transform both Z[:,0] and Z[:,1] in numpy arrays and simple lists, but I'm getting the same problem.