Object dtype instead of float


#1

Hello,

Below is the code :

table=dataset.pivot_table(index=[‘Gender’,‘Education’],values=‘LoanAmount’,aggfunc=np.median)
def fill(x):
if pd.isnull(x[‘LoanAmount’]):
return table.loc[x[‘Gender’],x[‘Education’]]
else:
return x[‘LoanAmount’]
train[‘LoanAmount’]=train.apply(lambda x:format(fill(x)),axis=1)
train[‘Loan_Amount_Term’]=train[‘Loan_Amount_Term’].fillna(360)

Dtype should be float64 but it is showing me object.
What am I missing ?(Avoid the indentation)