0

I'm trying to fill missing values for specific column but the original data frame doesn't change though I'm using inplace=True I tried this:

all_data.loc[all_data['GarageType'] == 'Detchd', 'GarageCond'].fillna('TA', 
inplace=True)

and this:

all_data.fillna({x:'TA' for x in ['GarageCond'] if ['GarageType'] ==  
'Detchd'}, inplace=True)

Edite : this worked

all_data.fillna({x:'TA' for x in ['GarageCond'] if 
(all_data['GarageType']=='Detchd').any()}, inplace=True)

1 Answers1

0

What are your version and environment?

Try this and let me know:

all_data = all_data.fillna({x:'TA' for x in ['GarageCond'] if ['GarageType'] ==  
                           'Detchd'}, inplace=True)
seralouk
  • 30,938
  • 9
  • 118
  • 133
  • I'm using jupyter, python3 all_data.fillna({x:'TA' for x in ['GarageCond'] if (all_data['GarageType'] == 'Detchd').any()}, inplace=True) this worked , thanks –  Nov 17 '18 at 13:15