import pandas as pd
df = {'Date': ["2011-10-19",
"2013-01-14",
"2014-05-27",
"2014-06-23",
"2014-08-12",
"2014-09-22",
"2014-09-22",
"2014-09-22"
], 'Status': ["Pending",
"Pending",
"Complete",
"Pending",
"Complete",
"Pending",
"Pending",
"Pending"],
'Group': ["a",
"a",
"a",
"a",
"b",
"b",
"b",
"b"]}
df = pd.DataFrame(data=df)
df
I would like to create another variable based on the change in Status over time for each group such that they are considered a "completer" the next row after they have Status = "Complete"
For example I would like to create the "completer" column in the df2 table:
df2 = {'Date': ["2011-10-19",
"2013-01-14",
"2014-05-27",
"2014-06-23",
"2014-08-12",
"2014-09-22",
"2014-09-22",
"2014-09-22"
], 'Status': ["Pending",
"Pending",
"Complete",
"Pending",
"Complete",
"Pending",
"Pending",
"Pending"],
'Group': ["a",
"a",
"a",
"a",
"b",
"b",
"b",
"b"],
'Completer': ["Non-Completer",
"Non-Completer",
"Non-Completer",
"Completer",
"Non-Completer",
"Completer",
"Completer",
"Completer"]}
df2 = pd.DataFrame(data=df2)
df2
Thanks!