ndarray.item()

numpy.ndarray.item

ndarray.item(*args)

Copy an element of an array to a standard Python scalar and return it.

<
Parameters:

*args : Arguments (variable number and type)

  • none: in this case, the method only works for arrays with one element (a.size == 1), which element is copied into a standard Python scalar object and returned.
  • int_type: this argument is interpreted as a flat index into the array, specifying which element to copy and return.
  • tuple of int_types: functions as does a single int_type argument, except that the argument is interpreted as an nd-index into the array.