I have this DF (gdp_g20) with information of GDP, first line example below:
Country Name Country Code Indicator Name Indicator Code 2014
Argentina ARG GDP (current US$) NY.GDP.MKTP.CD $526,320,000,000.00
I want to plot it but as the value types of column '2014' are string, it's not possible.
So anyone know how to convert gdp_g20['2014'] to numeric data? I've seen some posts but none of them worked.
Thanks in advance.
I tried removing the $ sign and convert with to_numeric, as below:
gdp_g20['2014'] = gdp_g20['2014'].apply(lambda x: x.replace('$', ''))
gdp_g20['2014'] = pd.to_numeric(gdp_g20['2014'])
But then I got the error:
"Unable to parse string " 526,320,000,000.00 " at position 0"