I have a dataset in python pandas with missing values for the variable Engine_model, but I have other rows with the same information. As I know that
Car_model Engine_Model
BMW 5 type A Renault 21 type B BMW 5 NaN Hyunday Santro type C
For example, in here I have a NaN that should be filled with 'type A', as that information is in the first row. How can I do that? Finding the information to fill NaN knowing that it Engine model is the same for all the cars of the same model?
I have obtained the indixes of the missing values and the car model names of those missing values:
Engine_model_missing_indices = data[data['Engine_mode'].isnull()].index
Carmodel_missing = data.loc[Engine_model_missingindices , 'Car_model']