Basically, I want to turn:
Date 0 1 2
0 10-1 thing1 None None
1 10-1 thing1 thing1 None
2 10-2 thing2 thing1 None
3 10-3 thing1 thing1 thing2
into a groupby:
Date 0
0 10-1 thing1 3
2 10-2 thing1 1
thing2 1
3 10-3 thing1 2
thing2 1
Details: Basically, I have a complicated "object" column from a JSON import. It's a list of dicts, each of which contains another list with the contents I'm interested in. I've managed to both "flatten" this final list to separate columns (0,1,2 above) as well as extract just the list itself to a column (i.e. [0,1,2]). The elements of these columns are all the same categorical variables (thing1, thing2, etc.)
I could imagine you could create new rows for each of the 1, and 2 columns, storing their values in the 0 columns, but if you can aggregate these values and groupby directly, that'd be great.