Question:
I want to replace values from a column in a dataframe to NaN and then replace Nan to the value from the previous row. This is the code that I’m currently using:And this is how my data looks like:
Now this is the desired output:

Hope you all can help me :c
Answer:
IIUC, one way usingffill
with groupby.transform
:If you have better answer, please add a comment about this, thank you!