0
$\begingroup$

I'm trying to create a new column called Class which is a calculated column. Basically when the Math class is NA then the class will be the CS class, otherwise it will be vice versa.

How can I do this in python? Table name is Classes

MathClass |  CSClass |  Class
------------------------------
Trig      |  NA      |  Trig
NA        |  Java    |  Java
NA        |  Python  |  Python  
$\endgroup$
0
$\begingroup$

Replace the missing value with empty string and add these columns up

Classes.fillna(value='').sum(axis=1)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.