Im having issue applying a currency rate in pandas. Some numbers are being converted as 'nan' whenever they contains a comma, eg: 1,789 will be considered as nan.
I started with that code :
import pandas as pd
usd_rate = 0.77
salary = pd.read_csv("salary.csv")
#create revenue clean (convert usd to gbp)
salary['revenue_gbp'] = salary.usd_revenue * usd_rate
So I was getting that error :
TypeError: can't multiply sequence by non-int of type 'float'
I've read you can't multiply the column by a float. So I converted my column to numeric :
salary.net_revenue = pd.to_numeric(salary.usd_revenue, errors='coerce')
salary['revenue_gbp'] = salary.usd_revenue * usd_rate
Now I don't have any errors, yet when I looked at my file , all of the number above 999.99 - so the ones containing a comma - are put under 'nan'...
I thought it could be translate issue .. but I'm getting confused here.. any ideas ?
Thanks a lot