jeudi 9 août 2018

Reference two sequences in for loop, then update first sequence based on their conditions - python

Trying to reference two sequences in a python for loop such as:

for (col1_row, col2_row) in (df.col1, df.col2)

Then check if two conditions are true:

if col1_row = 'nan' and col2_row = '1000 Main Street'

Then update the corresponding cell in df.col1 with a set value:

df.col1 == 'Chucky Cheeze Restaurant'

Does not have to be a for loop, but I thought I'd explain it this way. Looking for fastest, most efficient method. Thanks.

Aucun commentaire:

Enregistrer un commentaire