I wish to trim the list
[0,0,0,0,0,0,1,1,1,1,2,2,2,2,2,2,2,3,3,3,3, ... , 145,145,145]
into
[0,1,2,3,4,...,145]
I know the "C-Programming-style" way of doing it in Python.
I am here to ask for an intelligent and smart way of doing this.
I wish to trim the list
[0,0,0,0,0,0,1,1,1,1,2,2,2,2,2,2,2,3,3,3,3, ... , 145,145,145]
into
[0,1,2,3,4,...,145]
I know the "C-Programming-style" way of doing it in Python.
I am here to ask for an intelligent and smart way of doing this.
numpy.unique(mylist)
or list(set(mylist))
should do.
PS And it is not 'trimming' - that's a different thing...