mardi 16 juin 2020

Python: remove random values from multi-dimensional numpy array

I've created a multi-dimensional array and now I want to remove random values from numpy.ndArray() such that, the structure would be same, i.e. I don't want to shuffle array.

`array1 = [[1,2,3][4,5,6][7,8,9]]`

edit: sorry for providing less info, I want to remove elements randomly from multiple array but at same position in all arrays.

arr1 = [[1, 2, 3][4, 5, 6][7, 8, 9]]
arr2 = [[11, 12, 13][14, 15, 16][17, 18, 19]]

after removing:

arr1 = [[1, 2, 3][7, 8, 9]]
arr2 = [[11, 12, 13][17, 18, 19]]
for i in random_pos:
   arr1.remove(i)
   arr2.remove(i)

Also want 30% elements removed from array




Aucun commentaire:

Enregistrer un commentaire