python - How to replace ndarray with a number? -


i have following code:

arr = zip(*people2) in range(len(arr)):     j in range(len(arr[i])):         k in range(len(arr[i][j])):             if(arr[i][j][k] == 1):                 arr[i][j] = k                 break 

there array of arrays of arrays. need replace these last arrays numbers. this:

[  [[1, 0, 0], [2, 0, 0]],  [[3, 0, 0], [4, 0, 0]], ]  ->  [  [1, 2],  [3, 4] ] 

numbers here example.

how can this? tried use numpy.resize(), doesn't work.


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -