No numeric types to aggregate - Big mart sales intro code error , I av blog for big mart sales below code , is getting an error


#1

Hi , I av blog for big mart sales intro , this code is showing error - not supported between of instances of ‘float’ and 'str’
1)outlet_size_mode = data.pivot_table(values=‘Outlet_Size’, columns=‘Outlet_Type’,aggfunc=(lambda x:mode(x).mode[0]) )

I removed aggfunc then it is showing - No numeric types to aggregate
2) outlet_size_mode = data.pivot_table(values=‘Outlet_Size’, columns=‘Outlet_Type’)


#2

Hello Krish,

The error is because the column ‘Outlet_Size’ contain NANs. You could fill NA with some aribitary values ’ Unknown’ and then try to run the command. This should fix the issue.

below is the simulation for same:

Hope this helps :slight_smile: