[問題] pandas 迴圈運算
大家好 我想要問怎麼改變FOR 迴圈的起始和終值
比如說 我現有一個DF讀進來,然後
acc = df[df['成交時間']>=90500]
for mo in acc.index:
if df.iloc[mo,8] > 200:
buy = df.iloc[more+1,4]
out = 0
for mo in accumulate.index:
while out < -200:
out = out + df.iloc[mo+1,'vol']
我想要判斷df.iloc[mo,8] > 200 後買進 然後之前的加總的值小於200賣出
我以為mo 可以連貫的.好像不是這樣 要如何只做一次這個index就好
我要怎麼控制這個迴圈的起始值呢? 或是有更好的解法 謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 211.21.123.187
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1498120134.A.E6A.html
推
06/22 20:53, , 1F
06/22 20:53, 1F
→
06/22 20:55, , 2F
06/22 20:55, 2F
推
06/22 21:30, , 3F
06/22 21:30, 3F
→
06/22 21:55, , 4F
06/22 21:55, 4F
→
06/22 21:55, , 5F
06/22 21:55, 5F
推
06/23 04:44, , 6F
06/23 04:44, 6F
→
06/23 04:44, , 7F
06/23 04:44, 7F
推
06/23 08:52, , 8F
06/23 08:52, 8F
→
06/23 08:52, , 9F
06/23 08:52, 9F
→
06/23 09:58, , 10F
06/23 09:58, 10F
推
06/24 20:22, , 11F
06/24 20:22, 11F