I need to fill a certain value of null based on mode. I thought by groupby()
the name and the engine column by mode would solve the problem.
engine_df = df.groupby(['Name']).agg({'Engine':pd.Series.mode})[['Engine']].reset_index()
output:
Name Chevrolet Cruze LTZ AT
Engine [1991.0, 1998.0]
Name: 176, dtype: object
Because they have the same quantity, they appear with 2 values, while I need only 1 value. How to select the first value only?