Reputation: 941
Hi I'm not sure how to add a new column z to my existing df where z = x if x is not 0 else y .
For example:
Name x y |z (new col)
A 1 5 |1
B 2 6 |2
C 0 3 |3
D 0 0 |0
Does np.where apply in this case?
Thanks!
Upvotes: 1
Views: 85