Have a look at the example at the linked location:
#The first thing to do is to import the relevant packages
# that I will need for my script,
#these include the Numpy (for maths and arrays)
#and csv for reading and writing csv files
#If i want to use something from this I need to call
#csv.[function] or np.[function] first
import csv as csv
import numpy as np
#Open up the csv file in to a Python object
csv_file_object = csv.reader(open('../csv/train.csv', 'rb'))
header = csv_file_object.next() #The next() command just skips the
#first line which is a header
data=[] #Create a variable called 'data'
for row in csv_file_object: #Run through each row in the csv file
data.append(row) #adding each row to the data variable
data = np.array(data) #Then convert from a list to an array
#Be aware that each item is currently
#a string in this format
Python is indentation-sensitive. That is, the indentation level will determine the body of the for loop, and according to the comment by thegrinner:
There is a HUGE difference in whether your data = np.array(data) line is in the loop or outside it.
That being said the following should demonstrate the difference:
>>> import numpy as np
>>> data = []
>>> for i in range(5):
... data.append(i)
...
>>> data = np.array(data) # re-assign data after the loop
>>> print data
array([0, 1, 2, 3, 4])
vs.
>>> data = []
>>> for i in range(5):
... data.append(i)
... data = np.array(data) # re-assign data within the loop
...
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
AttributeError: 'numpy.ndarray' object has no attribute 'append'
As a side-note, I'd doubt the quality of the tutorial you are apparantly following is appropriate for bloody Python starters.
I think this more basic (official) tutorial should be more appropriate for a quick first overview of the language: http://docs.python.org/2/tutorial/