I am trying to add a column to my DataFrame , which is the product of separating two other columns, for example:
df['$/hour'] = df['$']/df['hours']
This works fine, but if the value in ['hours'] less than 1 , then the value of ['$/hour'] larger than the value in ['$'] , which is not what I want.
Is there a way to control the operation, so if ['hours'] < 1 , then df['$/hour'] = df['$'] ?
Charon
source share