mercredi 18 décembre 2019

calculation in new column with if and else in pandas [duplicate]

This question already has an answer here:


I am having below table

Particulars            DC    Amt
AA                     D      50
BB                     D      20
CC                     C      30
DD                     D      20
EE                     C      10

I require below output, if DC column is having "D" it should 
have same amount in "Amt" column and if DC column is "C" should 
multiply by (-1) with Amt amount.


Particulars            DC    Amt      TTL
AA                     D      50      50
BB                     D      20      20
CC                     C      30     (30)
DD                     D      20      20
EE                     C      10     (10)

Aucun commentaire:

Enregistrer un commentaire