vendredi 17 avril 2020

Apply the if else loop on the float data type in pandas data frame

I want to apply this function on the column that has the float values and i do not want to change the values to int data type as it would result in the loss of the information. I am getting the error ''float' object has no attribute 'Radiation'' Whats the solution to this problem as i do not want to keep the float data type and perform the if elese loop

radiation column values

=======

function to find the Day

def wplyer(row):
        if  row.Radiation == 0: 
            return 'Yes' ##### Night value
        else:
            return'No'
    tp= df2_all_rows['Radiation'].apply(wplyer)
    df2_all_rows['Day status'] = tp

Aucun commentaire:

Enregistrer un commentaire