Personally I'm doing this looping here:
for i in range(1, len(candles)):
if candles['askclose'][i]> candles['askopen'][i]:
candles['Fechamento'][i]= 'alta'
But the jupyternotebook always returns this warning and sometimes hangs and does not advance, any idea how to improve or make this looping different, to avoid the warning:
Warning:
C:\Users\Jair\Anaconda3\lib\site-packages\ipykernel_launcher.py:3: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
This is separate from the ipykernel package so we can avoid doing imports until
The mask as the friend suggested is great solution, but when I have a larger loop like this:
for i in range(1, len(candles)):
tamanho_twin = 0
if candles['Fechamento'][i]=='baixa' and candles['Fechamento'][i-1] == 'alta':
if candles['askclose'][i] <= candles['askopen'][i-1] and candles['MA20'][i]<candles['MA20'][i-2]:
limite_sombraV= ((candles['askclose'][i]-candles['askopen'][i])*0.1)+candles['askclose'][i]
if candles['asklow'][i] == limite_sombraV:
tamanho_twin = candles['askclose'][i]+candles['askopen'][i]
candles['Twintower'][i] = 0
candles['Tamanho_Twin'][i] = candles['askclose'][i]+candles['askopen'][i]