-1

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?

1 Answers1

0

if you want to disable the warning try this.

import pandas as pd
pd.options.mode.chained_assignment = None  # default='warn'

More information :How to deal with SettingWithCopyWarning in Pandas