I have some data that looks like...
Year Make Model Trim
2007 Acura TL Base
2010 Dodge Avenger SXT
2009 Dodge Caliber SXT
2008 Dodge Caliber SXT
2008 Dodge Avenger SXT
Trim
has some missing values. What I would like to do is something like the following:
- Group by year make and model
- Impute Trim if there are missing valyes for that group
So for instance, I would look at all the 2007 Acura TL. That might look like
Year Make Model Trim
2007 Acura TL Base
2007 Acura TL XLR
2007 Acura TL NaN
2007 Acura TL Base
Then, I would impute the Nan with Base (since Base is the Mode). It is important to remember here that I want to do this for every group of Year, Make, and Model.