I have a Pandas Series with integers. It looks something like this.
A = pd.Series({'data':[1,1,3,3,4,3,3,6,6,6,6,6,4,4]})
My desired output is
[1,3,4,3,6,4]
In other words, keep the first value, ignore any multiples. When 3
is reached, keep it, ignoring the multiple values, then 4
then 3
and so on.
The unique()
function is similar to what I want, but not quite the same. I need to preserve the order, and, if a number appears again at a later point, keep it as well.
This wouldn't be hard to do by simply looping through, but I would MUCH prefer a vectorized solution.