Imputing missing data


Imputing data

The link provided above explains the imputing the missing data.
And am unable to understand that why they use mode[0] in mode(data['Gender']).mode[0]

Kindly help :slight_smile:


A single data series can have multiple modes. Mode is value with highest number of occurrence and we can have one or values with same number of occurrence. By using Mode[0] we are selecting the first value from mode array (which can have more than one value.).

1 Like

Thank you @jasmeet. So, what I understood is that you are saying, Mode is an array which has highest number occurrence values (i.e.), ‘Male’ repeats again and we probably have only one mode right?. And Mode[0] we are pointing to the first point[0] in axis==0(column) ? So if we have another mode value, Can we take the next value like mode[1]? Can you help me with that for better understanding?


I need some practical and step by step explanation of the code. Can anyone please help me with this?

In the above picture, how can I fetch the second row data?. data.mode() shows a table of two different mode in ‘species’ as well as ‘wings’