samedi 23 avril 2016

If Statements and Setting Variables in Python

I'm trying to pass in df1, df2, df3 & df4 sequentially into the parseTwoPoleBreakers function. However, only df1 is being ran. Is there something wrong with my if elif statements that causing df2, df3 & df4 to not be passed into the parseTwoPoleBreakers function?

i=0
for j in range(0,4):
    if j==0:
        df=df1
    elif j==1:
        df=df2
    elif j==2:
        df=df3
    else:
        df=df4
    #execute this for each dataframe
    while (i<7):
        parseTwoPoleBreakers(7,8,"ab",i,df)
        breakerid+=1
        parseTwoPoleBreakers(9,10,"bc",i,df)
        breakerid+=1
        parseTwoPoleBreakers(11,12,"ca",i,df)
        breakerid+=1
        i+=1
    #j+=1
    print j

Aucun commentaire:

Enregistrer un commentaire