mardi 11 juillet 2017

How to save a file in pandas using if statement?

I would like to save the lines only if field 2 and field 3 doesn't match. For example in id "AAA" ,

id    field2    field3
AAA    SRE        SRE
AAA    FSD        FRE
AAA    TUE        TUE
ABA    SDE        SDE
AAA    FRT        QRE
AAA    HRE        HRE
ABA    EEE        EEE
ABA    URE        FRE

How to save to output file using if statement,

file = "/output.csv"
df.to_csv(file, sep="%", index=False)

Aucun commentaire:

Enregistrer un commentaire