I have two DataFrames:
df- the core DataFrame with columns/cells that I want to expandmaptable- a maptable DataFrame that maps certain columns
An example:
maptable:
id | period
A | winter
B | summer
A | summer
nan | summer
B | nan
df:
id | period | other_col
A | None | X
B | summer | Y
C | None | Z
D | spring | D
D | NaN
How can I only map the cells in df that are None/empty/nan using the maptable and the identifier column id?
df['period'].fillna(df['id'].map(maptable.set_index('id')['period']))?