jeudi 3 mai 2018

If greater than divide by value elif pass

I want to change all the values of the column FuelFlow in df_OmanAirTO that are larger than 5800. The values larger than 5800 should be devided by 2,2046226218. The other values that are smaller than 5800 should stay the same. I am a beginner in Python and tried the following:

for row in df_OmanAirTO.FuelFlow:
    if row>=5800:
        df_OmanAirTO.FuelFlow/2.2046226218
    elif row<=5800:
        pass
    print(df_OmanAirTO.FuelFlow)

I am not receiving an error, but my values in the column FuelFlow have not changed either. What would be a right script?

Thank you for helping me in advance!

Aucun commentaire:

Enregistrer un commentaire