1

I have a dataframe that contains missing categorical values:

  Item   City
0    A   Paris
1    B   
2    C   Rome
3    D   London
4    A   Paris
5    B   Berlin
6    C   
7    D   London
8    C   Rome
9    C   London
10   E   
11   E   London
12   E   Paris
13   F   
14   F   

I want to fill the missing values with the corresponding value where Item has the most frequent value.

Rows 1, 6 and 10 are taken care of by this answer, but not 13 and 14, so this throws an error. Here I want to use the most frequant value of another column (not in the example). How can I deal with this?

Any ideas how to do that?

0 Answers0