I am getting an error in python for the below piece of code. I even added the .loc arguement after reading further about this error but still the error pops up.
thrsh=calib1[calib1.VARIABLE.str.contains("Threshold")]
thrsh.loc[:,'Threshold_Price'] = thrsh['VARIABLE'].str.split(' ').str[0]# problem statement
Its a simple operation wherein I am trying to add a new variable - Threshold_Price. Threshold price would have value 1_29 if column "Variable" has value - 1_29 Regular Price Threshold
Error Msg: C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\indexing.py:362: 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 self.obj[key] = _infer_fill_value(value) C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\indexing.py:543: 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 self.obj[item] = s