I have a small problem with creating an if statement in python. I am compering two csv files using Panda Library and I want to create an if statement which will be checking if list is empty. So this is my code
file1 = pd.read_csv('otomotofirst.csv')
file2 = pd.read_csv('otomotonew.csv')
change=(file2[~file2.Linki.isin(file1.Linki)])
if change is None:
break
else:
send_mail(subjectNew,change)
It is working quite well, however if it is empty (or in my case None) email is also sent. Of course it sends an empty list but it doesn't break.
I was trying do it with True and False statement but this error always pop ups
ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()
change.shape[0]orlen(change)to check if the length is 0