This is simple request in python where I need to update 0 where the value in none in one fo the column in mydataframe. I have used following code to do it
test['WIN_AMOUNT_BF_FEATURE']=test['WIN_AMOUNT_BF_FEATURE'].fillna(0)
This works great, however I get a warning
C:\WINDOWS\TEMP/ipykernel_11784/720693040.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 test['WIN_AMOUNT_BF_FEATURE']=test['WIN_AMOUNT_BF_FEATURE'].fillna(0)
I understand using loc will make this process twice faster here. Just not sure how to do this update with the help of loc. I tried following however thats definetly stupid guess here as it didn't work. Please how can I do this with the help of
> loc.
test.loc[test['WIN_AMOUNT_BF_FEATURE']] =test.loc[test['WIN_AMOUNT_BF_FEATURE']].fillna(0) this one didn't work.