I have Data Frame with IDs in the first column and number of cycle in second.
Here's an example of what it looks like:
df2 = pd.DataFrame(np.array([[1, 1], [1, 2], [2, 1], [2, 2], [2, 3]]),
columns=['ID', 'cycle'])
ID cycle
1 1
1 2
2 1
2 2
2 3
I want to make new column with 2 classes: 'last cycle', 'not last cycle':
ID cycle group
1 1 0
1 2 1
2 1 0
2 2 0
2 3 1
How to solve this task?
Thanks in advance for replies