Skip to content Skip to sidebar Skip to footer

See If A Value Exists In A Dataframe

In Python to check if a value is in a list you can simply do the following: >>>9 in [1,2,3,6,9] True I would like to do the same for a Pandas DataFrame but unfortunately

Solution 1:

Basically you have to check the matrix without the schema, so:

 7 in df.values

x in df checks if x is in the columns:

for x indf:
    print x,

out: a b c d

Post a Comment for "See If A Value Exists In A Dataframe"