Ask Your Question
0

How can i counter frequent array in numpy?

asked 2015-12-12 09:25:28 -0600

Nazila gravatar image

import numpy as np X=np.array[[1,2], [3,4], [1,2], [4,1]] "i want to counter repetitive [1,2]"

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2015-12-13 07:44:04 -0600

tmonteil gravatar image

updated 2015-12-13 07:44:20 -0600

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]]
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2015-12-12 09:25:28 -0600

Seen: 132 times

Last updated: Dec 13 '15