How can i counter frequent array in numpy?
import numpy as np X=np.array[[1,2], [3,4], [1,2], [4,1]] "i want to counter repetitive [1,2]"
import numpy as np X=np.array[[1,2], [3,4], [1,2], [4,1]] "i want to counter repetitive [1,2]"
It is somehow a duplicate of this question, you can change the bi-dimensional numpy array X
into a list of lists as follows:
sage: Y = [list(x) for x in X]
sage: Y
[[1, 2], [3, 4], [1, 2], [4, 1]]
Please start posting anonymously - your entry will be published after you log in or create a new account.
Asked: 2015-12-12 16:25:28 +0100
Seen: 550 times
Last updated: Dec 13 '15