You can just compare the column against the value of interest and call cumsum:
In [12]:
df['obj1_count'] = (df['object'] == 'obj1').cumsum()
df['obj2_count'] = (df['object'] == 'obj2').cumsum()
df
Out[12]:
time object obj1_count obj2_count
idx
0 04:10 obj1 1 0
1 04:10 obj1 2 0
2 04:11 obj1 3 0
3 04:12 obj2 3 1
4 04:12 obj2 3 2
5 04:12 obj1 4 2
6 04:13 obj2 4 3
Here the comparison will produce a boolean series:
In [13]:
df['object'] == 'obj1'
Out[13]:
idx
0 True
1 True
2 True
3 False
4 False
5 True
6 False
Name: object, dtype: bool
when you call cumsum on the above the True values are converted to 1 and False to 0 and are summed cumulatively