kame kame - 4 months ago 9
Python Question

How to call an element in an numpy array?

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(0,0)


The code above doesnt work.

Answer

Just use square brackets instead:

print arr[1,1]