I am trying to create a new column that checks if there's a string in my values using the following method:
user['validacao_LP']=user['MEDIA_SOURCE'].str.contains('LP')
But I keep getting the following message:
<ipython-input-27-841ac3ae43d8>: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
user['validacao_LP']=user['MEDIA_SOURCE'].str.contains('LP')
I have already tried to use the lines bellow aftwer reading the documentation but I keep getting the same message.
user.loc[:,'validacao_LP']=user.loc[:,'MEDIA_SOURCE'].str.contains('LP')
user['validacao_LP']=user.loc[:,'MEDIA_SOURCE'].str.contains('LP')
user.loc[:,'validacao_LP']=user['MEDIA_SOURCE'].str.contains('LP')