It's a bit hard to explain, so I'll start off with what I'm trying to achieve using excel.
Basically, the value of the "Active" column is based on values of the same row different column values (columns 'Act Count' and 'De Count'), as well as the value in the previous row of the "Active" column.
From the excel formula, if 'Act Count' < 4 and 'De Count' < 4, 'Active' = the previous row's 'Active' value.
I want to transition this to Python pandas dataframe.
Here is the sample data:
import pandas as pd
df = pd.DataFrame({'Act Count':[1,2,3,4,0,0,0,0,0,0,0,0,0,0],
'De Count':[0,0,0,0,0,0,0,0,1,2,3,4,5,6]})
You can assume the first row value of 'Active' = 0.
I know of .shift() function, however I feel like I can't use it because I can't shift a column that doesn't exist yet.
