Quantcast
Channel: Data Science, Analytics and Big Data discussions - Latest topics
Viewing all articles
Browse latest Browse all 4448

TypeError when finding mode for each Outlet_Type

$
0
0

@warrior wrote:

When I run this code from the tutorial:

#Import mode function:
from scipy.stats import mode

#Determing the mode for each
outlet_size_mode = data.pivot_table(values='Outlet_Size', columns='Outlet_Type',aggfunc=(lambda x:mode(x).mode[0]))
print ('Mode for each Outlet_Type:')
print (outlet_size_mode)

I get

TypeError: '<' not supported between instances of 'str' and 'float'

I know the error occurs because Outlet_Size has missing values but I’m not sure how to correct it.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4448

Trending Articles