I have a dataset like this one:
A | B |
---|---|
x | a |
x | nan |
y | c |
z | d |
Let’s say I want to change the last two rows and replace the values with the previous not nan values in the same column to get this dataset:
A | B |
---|---|
x | a |
x | nan |
x | a |
x | a |
How can I obtain this?