I am new to python and doing practice with pandas. In my data frame there's a column called NET_REVENUE and its type is string. I'm trying to convert it into float for further analysis.
However, when I run following code it gives feedback I don't really understand. I am positive that there were no missing value in the original column. Obviously some have been converted successfully into float. But 2918 out of 4732 are not.
Can someone help please?
sep_IM_2019['NET_REVENUE_numeric'] = pd.to_numeric(sep_IM_2019['NET_REVENUE'], errors='coerce')
/Users/Leo/opt/miniconda3/lib/python3.7/site-packages/ipykernel_launcher.py:1: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy """Entry point for launching an IPython kernel.
sep_IM_2019.NET_REVENUE_numeric.isnull().sum()
#2918
sep_IM_2019.NET_REVENUE_numeric
8 NaN
46 NaN
56 NaN
62 NaN
71 NaN
..
76472 NaN
76476 NaN
76503 NaN
76505 NaN
76510 NaN
Name: NET_REVENUE_numeric, Length: 4732, dtype: float64