A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
df1.loc[i,'Long_P/L'] = ((df1.iloc[i]['Sell_Price'] - df1.iloc[i-1]['Buy_Price'])*df1.iloc[i-1]['Long_qty']-(cap*0.00017))
How to solve this warning?