I am trying to find elements in a series, s1 that are not there in series, s2.
s1 = pd.Series(range(1,6))
s2 = pd.Series(np.array(range(1,6))*2)
pd.Series([item for item in s1 if item not in s2])
I get only the element '5' as the output. Whereas, I should get a series of 1,3,5 as the output.
Similarly, for another example
s1 = pd.Series(range(2,8))
s2 = pd.Series(np.array(range(1,6))*2)
pd.Series([item for item in s1 if item not in s2])
I get only the elements 5,6,7 as outputs. The element 3 isn't received in the output.
Can anyone please guide me on what is happening here?