I have a dataframe with columns A, B. I need to add a column C which is basically the division of entries in A by the entries in B.
I tried this:
df['C'] = df['A'] / df['B']
But I need to convert to double or float before I do this. How should I type-cast the dtype of the columns?
Thanks.
How about
df['C'] = df['A'] * 1.0 / df['B']
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With