I have a dataframe looks like this
df = pd.DataFrame({'id': ['T01', 'T01', 'T01', 'T02', 'T02', 'T03', 'T03'],
'event_list': [(['a', 'b']),
(['a', 'c']),
(['a', 'b', 'c']),
(['a']),
(['a','b']),
(['a', 'b', 'c']),
(['b', 'c'])]})
I wanna group-by id column and count the element inside of the list, so the desired output will look like this
df = pd.DataFrame({'id': ['T01','T01','T01','T02','T02', 'T03', 'T03','T03'],
'event': ['a','b','c','a','b','a','b','c'],
'count': [3,2,2,2,1,1,2,2],})