Skip to content Skip to sidebar Skip to footer

Fill NaN Values

I have a dataframe TIMESTAMP P_ACT_KW PERIODE_TARIF P_SOUSCR 2016-01-01 00:00:00 116 HC 250 2016-01-01 00:10:00 121 HC 250 2016-01-01 00:20:00 121 NaN 250 To use this dataframe, I

Solution 1:

use isin to test for membership:

data['PERIODE_TARIF']=np.where(data['PERIODE_TARIF'].isin([0, 1,2, 3, 4, 5, 22, 23]),'HC','HP')

in doesn't understand how to evaluate an array of boolean values as it becomes ambiguous if you have more than 1 True in the array hence the error


Post a Comment for "Fill NaN Values"