Given a sample of data such as this
3,12.2,3.03,2.32,19,96,1.25,.49,.4,.73,5.5,.66,1.83,510
3,12.77,2.39,2.28,19.5,86,1.39,.51,.48,.64,9.899999,.57,1.63,470
3,14.16,2.51,2.48,20,91,1.68,.7,.44,1.24,9.7,.62,1.71,660
3,13.71,5.65,2.45,20.5,95,1.68,.61,.52,1.06,7.7,.64,1.74,740
3,13.4,3.91,2.48,23,102,1.8,.75,.43,1.41,7.3,.7,1.56,750
3,13.27,4.28,2.26,20,120,1.59,.69,.43,1.35,10.2,.59,1.56,835
3,13.17,2.59,2.37,20,120,1.65,.68,.53,1.46,9.3,.6,1.62,840
3,14.13,4.1,2.74,24.5,96,2.05,.76,.56,1.35,9.2,.61,1.6,560
and my code
import numpy as np
with open("wine.txt","r") as f:
stuff=f.readlines()
#np.genfromtxt("wine.txt", delimiter=",")
z=np.empty((0,14),float)
for hello in stuff:
firstbook=hello.strip().split(",")
x=[float(i) for i in firstbook]
y=np.array(x)
b=np.append(b,y)
print b[1:2]
I'm having trouble getting a numpy array that is made out of the entire data set(I'm only getting the last row of the set as the array), such that it would give me the entire column of elements when I print(as in the last line of code). I'm only getting [14.13] when I reach the last line
b[1:2]- what result do you expect ?