Hi There,
I am trying to replicate one of the SAS functions in Python, not sure how to do it. It would be great if you guys can assist me with this.
Below is the requirement.
I want to perform 2 different functions here.
Below is the dummy dataset:
Kind regards,
CK
I am trying to replicate one of the SAS functions in Python, not sure how to do it. It would be great if you guys can assist me with this.
Below is the requirement.
I want to perform 2 different functions here.
Code:
if name in ("spiderman","antman") and salary in range(1000,2000) and city not in ("boston","dubai"): new_column=age+salary else: new_column=age*salary
Below is the dummy dataset:
Code:
name age salary city spiderman 20 100 boston he-man 21 200 london superman 22 300 newyork thor 23 400 cairns ironman 24 500 sydney aquaman 25 600 california antman 26 700 spain optimus prime 27 100 sydney bumble bee 28 170 newyork what man 29 290 london spiderman 30 1000 auckland spiderman 31 1800 beijing spiderman 32 3000 delhi antman 33 100 tokyo antman 34 5000 moscow antman 34 1200 dubai antman 35 1800 malaysia
CK
Comment