QST: SettingWithCopyWarning -->self.obj[item_labels[indexer[info_axis]]] = value issue
Hello,

I am struggling in assigning new columns in my data frame, based on existing columns in the same data frame. 

I keep getting this SettingWithCopyWarning that is driving me crazy:

_C:\ProgramData\Anaconda3\envs\PLAXIS_V20.3_python37\lib\site-packages\pandas\core\indexing.py:1596: 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
  self.obj[key] = _infer_fill_value(value)
C:\ProgramData\Anaconda3\envs\PLAXIS_V20.3_python37\lib\site-packages\pandas\core\indexing.py:1783: 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
  self.obj[item_labels[indexer[info_axis]]] = value_

The code that I am trying to run is the following:

__dfe = df_sampled.loc[mask]
af=dfe["Dist_{}_{}_UKPN_ mm".format(i,j)]
af.apply(lambda x: ((x*0.001)/ref)*100)
dfe.loc[:,"Dist_{}_{}_UKPN_ perc".format(i,j)]=af

My goal is to create a new column on the dfe dataframe ( which is a sub dataframe from another dataframe), which is based on the existing column on the dfe, but multiple by scalars values ( e.g to convert them into percentage)

I hope someone can help to understand how to overcome this 

Thanks 

F.