I am trying to do the following.
df_county_outcomes['county'] = df_county_outcomes['county'].apply(lambda x : '0' + str(x) if len(str(x)) == 1 else str(x))
I get the correct result but the SettingWithCopyWarning will always be there. Can someone help? Thanks a lot in advance!
It could be due to a few reasons. This article helped me immensely.
TLDR is you can use
pd.set_option('mode.chained_assignment', None)
to suppress that warning if you are certain what you're doing is okay. In your case it looks like you can suppress the warning.