I have a dataframe df1
.
Time Category
23:05:07 a
23:11:12 b
23:12:15 a
23:16:12 a
Another dataframe df2
has been created returning the count of occurences of each of the unique values in column category
and into intervals of 5 minutes. Using this code df2= df1.resample('5T').category.value_counts()
df2
Time Category Category
23:05 a 1
23:10 a 1
23:10 b 1
23:15 a 1
Is there a way to use the unique values as column headers? Look like:
Time a b
23:05 1 0
23:10 1 1
23:15 1 0