Slicing Cross-section of 2D NumPy array
<p>I'm looking to print a cross-section of a numpy array. I am looking to pull the first 15 rows and only data from the 5th index column.</p>

<pre><code>import csv as csv
import numpy as np 

csv_file_object = open('train.csv', 'rU')
header = next(csv_file_object)
data = []

for row in csv_file_object:
    data.append(row)

data = np.array(data)

print(data[0:15,5])
</code></pre>

<p>When I run the above code, I receive the following error: IndexError: too many indices for array.</p>

<p>Running the code without adding the column filter works as expected. The csv file is a 12x892 (x,y) dataset.</p>

<p>UPDATE: I did not call csv.reader() prior to opening the file</p>

<pre><code>import csv as csv
import numpy as np 

csv_file_object = csv.reader(open('train.csv', 'rU'))
header = next(csv_file_object)
data = []

for row in csv_file_object:
    data.append(row)

data = np.array(data)

print(data.shape)
print(data[0:15,5])
</code></pre>

python arrays numpy indices