python - how to extract a zero-dimensional slice from a 1-dimensional array in numpy -
Is a 1-dimensional array slice the zero-dimensional sub-array?
ndarray However, if I have 1-dimensional The minimum example: I realize that Use an oval: arr ,
arr [0] (N-1 ) - Dimensional
Ndarray .
ndarray
x ,
x [0] 0-dimensional ndarray is not back Returns, rather a
numpy.int64 , (if
x contains
int64 s).
def increment (zero_d_array): zero_ad_rere [...] = zero_a_array + 1 counter = mmp.re (0) # zero-dimensional with scalar Array increments (counter) # Success; Counter now 1 counter = numpy.zeros (3, dtype = int) # [0, 0, 0] increment (counter [1]) # failed; Counter [1] is a numpy.int64, not 0-D array
will work with increments (counter [1: 2]) , But only because
increments () works with both 0-D and 1-D input, all functions will be so flexible.
increment (counter [ 1, ...])
Comments
Post a Comment