I'm trying to add a column to my DataFrame
which is the product of division of two other columns, like so:
df['$/hour'] = df['$']/df['hours']
This works fine, but if the value in ['hours']
is less than 1
, then the ['$/hour']
value is greater than the value in ['$']
, which is not what I want.
Is there a way of controlling the operation so that if ['hours'] < 1
then df['$/hour'] = df['$']
?