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 matplotlib
import matplotlib.pyplot as plt
import numpy
def parseFile(file):
F = open(file)
n = len(F.readlines()) #no. of lines in file
numpyMat = numpy.zeros((n,3)) # create numpy matrix
classLabelVector = []
F = open(file) # from the beginning again
i = 0
for line in F.readlines():
line = line.strip()
listFromLine = line.split()
numpyMat[i,:] = listFromLine[0:3] # 3 is the no. of variables/columns
classLabelVector.append(int(listFromLine[-1]))
i+=1
return numpyMat, classLabelVector
dataMatrix = parseFile('kiwibubbles_tran.txt')
fig = plt.figure()
ax = fig.add_subplot(111)
ax.scatter(dataMatrix[:1], dataMatrix[:2]) # Error
plt.show()
Error: ValueError: could not broadcast input array from shape (857,3) into shape (857)