mercredi 9 septembre 2020

Many conditions in one if / elif statement

Hey I am trying to put a lot of arguments in an if statement. It has to be with an if statement because it is used for another program as well. So far I get the error: SyntaxError: invalid syntax. How can I make this Statement work?

if (df['Gondelposition'].(axis=1) > 720):
    df['Gondelposition'].(axis=1) - 360
elif (df['Gondelposition'].(axis=1) > 360):
    df['Gondelposition'].(axis=1) - 360
elif(df['Gondelposition'].(axis=1) < -720):
    df['Gondelposition'].(axis=1) + 360
elif (df['Gondelposition'].(axis=1) < -360):
    df['Gondelposition'].(axis=1) + 360   
else:
    print(df['Gondelposition'].(axis=1))

In the best case I could to a new column in my df with the results. In the end every value need do be between 0 an 360.

Aucun commentaire:

Enregistrer un commentaire