1

I have a list called myList = []. I want to compare the ones in the zero index of this list with the ["numbers"] arm of the dataframe pd. I want to separate those that are not the same as the list.

For example:

myList=["20","30","40","31","41"]
pd["numbers"] = ["20","30","40","41","31",**"50"**]
Ajith
  • 1,447
  • 2
  • 17
  • 31
feyZ1g
  • 62
  • 8

1 Answers1

1

Using set

Ex:

myList=["20","30","40","31","41"]
df = pd.DataFrame({"numbers": ["20","30","40","41","31","50"]})
print(set(df['numbers']) - set(myList))
# --> {'50'}
Rakesh
  • 81,458
  • 17
  • 76
  • 113