Value Error: Could Not Broadcast Input Array From Shape (857,3) Into Shape (857)
I've been trying to plot a database that I parsed from a text file into a numpy array. The array has 857 rows. This error keeps popping up, I dont understand what it means. import
Solution 1:
Your dataMatrix
is a tuple, so you have two options:
Take the results of the fuction in two different variables:
numpyMat, classLabels = parseFile('kiwibubbles_tran.txt')
fig = plt.figure()
ax = fig.add_subplot(111)
ax.scatter(numpyMat[:,1], numpyMat[:,2])
plt.show()
Plot only the numpyMat from the tuple:
dataMatrix = parseFile('kiwibubbles_tran.txt')
fig = plt.figure()
ax = fig.add_subplot(111)
ax.scatter(dataMatrix[0][:,1], dataMatrix[0][:,2])
plt.show()
Post a Comment for "Value Error: Could Not Broadcast Input Array From Shape (857,3) Into Shape (857)"