test_input = pd.DataFrame(columns=['key', 'value'], data=[[1, 'A'], [1, 'B'
    ], [1, 'B'], [1, np.nan], [2, np.nan], [3, 'C'], [3, 'C'], [3, 'D'], [3,
    'D']])
Group by pandas dataframe and select most common string factor