@ASHISH_17 wrote:
I am trying to fill missing values of Dependents column using the below code and getting -
TypeError: (‘cannot use label indexing with a null key’)
Code is -
table=df.pivot_table(index=‘Gender’,columns=‘Dependents’,values=‘ApplicantIncome’,aggfunc=‘mean’)
print table
def combine(x):
return table.loc[x[‘Gender’],x[‘Dependents’]]
df[‘Dependents’].fillna(df[df[‘Dependents’].isnull()].apply(fage1,axis=1),inplace=False)
Posts: 1
Participants: 1