Jul-20-2023, 01:33 PM
Hi !
I'd like to ask for some help. I am a newbie in python so please forgive me if my problem is obvious.
I have this DataFrame :
- 'True' is replaced by the value in column 'A'
- 'False is replaced by the value of the row above
See below for the result I want.
Thank you for your help ;)
I'd like to ask for some help. I am a newbie in python so please forgive me if my problem is obvious.
I have this DataFrame :
import pandas as pd test = pd.DataFrame({'A':[0, 1, 5, 2, 4, 5, 3, 2, 3]}, index = range(9)) test['B']=(test['A']==test['A'].rolling(5, center = True).max())I want to create an other column 'C' or modify column 'B' so that
- 'True' is replaced by the value in column 'A'
- 'False is replaced by the value of the row above
See below for the result I want.
Thank you for your help ;)