Use .loc for assignments

This commit is contained in:
Matthias 2020-01-25 11:42:31 +01:00
parent 3fcd531eac
commit de47186263
1 changed files with 2 additions and 2 deletions

View File

@ -149,8 +149,8 @@ class Backtesting:
# To avoid using data from future, we use buy/sell signals shifted
# from the previous candle
df_analyzed.loc[:, 'buy'] = df_analyzed['buy'].shift(1)
df_analyzed.loc[:, 'sell'] = df_analyzed['sell'].shift(1)
df_analyzed.loc[:, 'buy'] = df_analyzed.loc[:, 'buy'].shift(1)
df_analyzed.loc[:, 'sell'] = df_analyzed.loc[:, 'sell'].shift(1)
df_analyzed.drop(df_analyzed.head(1).index, inplace=True)