Using this simple line of code, I keep on getting a SettingWithCopyWarning error that than carries through my whole code.
#make email a string
df['Email Address'] = df['Email Address'].astype(str)
C:\Users\xxx\AppData\Local\Continuum\Anaconda2\lib\site-packages\ipykernel\__main__.py:2: 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: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
from ipykernel import kernelapp as app
I went through the documentation, but can't make it work with loc. The code below is wrong.
df.loc['Email Address'] = df.loc['Email Address'].astype(str)
Please excuse if this is a duplicate question - I searched it on stackoverflow, but couldn't find one that addresses loc and astype.