I'm using pandas to read from an excel workbook and extract some data. I have this piece of code in my project:
week_list = []
for index, row in date_sort.iterrows():
date = row.iloc[1].to_pydatetime()
cuenta = row.iloc[8]
if (date >= week):
if (account == 'office'):
print(row)
<do stuff>
else:
break
Where row.iloc[1] points to the cell with a date, and row.iloc[8] points to to a cell with a string. The above code works just fine for my purposes. But if I try to write:
if (date >= week and account == 'office'):
instead of
if (date >= week):
if (account == 'office'):
It skips the if statement all together. What is happening here?
Aucun commentaire:
Enregistrer un commentaire