Lets say I have the following Time Series with an item:
df:
date item
1/6/2021 apples
1/6/2021 apples
1/6/2021 oranges
1/6/2021 oranges
1/7/2021 oranges
1/8/2021 bananas
2/1/2021 apples
2/1/2021 apples
2/1/2021 apples
2/1/2021 apples
2/2/2021 oranges
2/3/2021 bananas
3/1/2021 apples
3/1/2021 apples
3/1/2021 apples
3/1/2021 apples
3/1/2021 oranges
3/2/2021 oranges
3/3/2021 bananas
I would like to make a count of each item and have it broken out by week then plot the results in a bar graph. week is Saturday to Saturday.
week of item count
1/9/2021 apples 2
oranges 3
bananas 1
2/6/2021 apples 4
oranges 1
bananas 1
3/6/2021 apples 4
oranges 2
bananas 1
I tried the following code:
df.groupby(pd.Grouper(key='date',freq='W')
for name, group in weekly:
print(group.item.unique(), group.item.count())
That was able to give me the list of items and the sum of all the items, but Im not sure how to get the sum of each item or plot it.
