I'm trying to convert Dtype object to Dtype float64. Please see the below for the df and info before conversion:
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 101 entries, 2012-01-31 to 2020-05-27
Data columns (total 1 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 MSCI World Index (MXWO) - Index Value 101 non-null object
dtypes: object(1)
I then applied this line of code to convert the column "MSCI World Index (MXWO) - Index Value" into float64:
MSCI['MSCI World Index (MXWO) - Index Value']=pd.to_numeric(MSCI['MSCI World Index (MXWO) - Index Value'],errors='coerce')
When I call for the df, I get the following result:
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 101 entries, 2012-01-31 to 2020-05-27
Data columns (total 1 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 MSCI World Index (MXWO) - Index Value 0 non-null float64
dtypes: float64(1)
What changes should I do to the code in order that the values would be displayed correctly so that I can perform calculations using the values?