tags:

views:

32

answers:

1

This is a really simple question, but I didnt find the answer. How to call an element in an numpy array?

import numpy as np

arr = np.array([[1,2,3,4,5],[6,7,8,9,10]])

print arr(1,1)

The code above doesnt work.

+4  A: 

Just use square brackets instead:

print arr[1,1]
carl
+1. Extra info: numpy arrays are 0-based, that means if you want to get the 1 from the array you should use `arr[0,0]` instead of `arr[1,1]`.
KennyTM
:( Dont be angry with me :/
kame