我有这个代码
def ch1(div,pares): 对于zip中的j(div,pares): dtm = pares [j] etiqueta = div [j]
fig = go.Figure(data=[go.Candlestick(x=dfm['Date'],
open=dfm['Open'],
high=dfm['High'],
low=dfm['Low'],
close=dfm['Price'])])
fig.update_layout(
title= etiqueta,
)
fig.show()
答案 0 :(得分:0)
可能的解决方案可以在这里找到: How to iterate through two lists in parallel?
您的代码应类似于以下内容:
def ch1(div, pares):
for m_div, m_pares in zip(div, pares):
dtm=m_pares
etiqueta=m_div
fig = go.Figure(data=[go.Candlestick(x=dfm['Date'],
open=dfm['Open'],
high=dfm['High'],
low=dfm['Low'],
close=dfm['Price'])])
fig.update_layout(
title= etiqueta,
)
fig.show()
ch1(div, pares)