I have a dataframe df:
import pandas as pd
d = {'cola': ['a1', 's7', 'm5']}
df = pd.DataFrame(d)
df
    cola
0     a1
1     s7
2     m5
The output of the code below is 1 but it should be 0 because s7 in cola is not in ['a1', 'r3', 'm5']:
if ~df["cola"].isin(['a1', 'r3', 'm5']).any():
    print(0)
else:
    print(1)
What the code should do is print 0 if any value of Column A (cola) is not of the type a1, r3 or m5.
 
    