import numpy as np
import pandas as pd
list1=pd.DataFrame({'A':['a','b','c','d','x'],'B':['a','b','c','d','x']})
list2=[['1','b','c','a']]
list3=['a','b','c','d','e']
list1
    A   B
0   a   a
1   b   b
2   c   c
3   d   d
4   x   x
i get a value error:
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
When I do replace list1.B using list3: it works.
for i in range(len(list1.A)):
    if list1.A[i] in list3:
        list1.B[i]='ONLINE'
list1
    A   B
0   a   ONLINE
1   b   ONLINE
2   c   ONLINE
3   d   ONLINE
4   x   x
How do I do for list2? Thanks I tried query and isin too doesn't work.
 
    