Compare two pandas series and remove duplicate

Question:

I am new here and i just start programming in python.

I have two series:

ser1 = pd.Series([1,2,3,4,5])
ser2 = pd.Series([4,5,6,7,8])

And i want to compare ser1 and ser2 and then remove the duplicate one to ser1 to have something like this:

>>> ser1
    out = 1 2 3

i tried pd.concat but This gave me the combine of the two series wihtout the duplicate

thanks in advance

Asked By: SnowManShow

||

Answers:

(set(ser1).difference(ser2))
{1, 2, 3}
Answered By: Naveed
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.