lundi 2 décembre 2019

Error: The truth value of a Series is ambiguous. Tried many things but code still does not work

I saw many similar post and tried most of them, but still cant figure out why issue persists

def move(row):
    if ((min100['Flag_cost']==1) & (complete['Cost'] < 0)):
        if (complete['Move']==1) & (complete['prediction']<10):
            complete['prediction'] += 1
        elif ((complete['Move']==-1) & (complete['prediction']>0)):
            complete['prediction'] += -1
    return

complete= complete.apply(move, axis=1)

In dataframe: 'Flag_cost' can take value 0 or 1; 'Cost' can take value (-inf,inf); 'Move' can take value -1 or 1; 'prediction' can take value integers 0 to 9

ValueError: ('The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().', 'occurred at index 0')

Aucun commentaire:

Enregistrer un commentaire