I'm checking to see if all the values in one column of one dataframe lies in the column of another dataframe. When I run the code below, it says that 4 does not exist in df1. Is there any particular reason for this?
list1=[1,2,3,4]
list2=[1,2,3,4]
df2=pd.DataFrame(list2)
df2.rename(columns={0:"List2"},inplace=True)
df1=pd.DataFrame(list1)
df1.rename(columns={0:"List1"},inplace=True)
for i in df2['List2']:
if i not in df1['List1']:
print(i)