plot one variable grouped by another variable in python code example
Example 1: how plot graph by using group by function in python
#plot data
fig, ax = plt.subplots(figsize=(15,7))
data.groupby(['date','type']).count()['amount'].plot(ax=ax)
Example 2: how plot graph by using group by function in python
# plot data
fig, ax = plt.subplots(figsize=(15,7))
# use unstack()
data.groupby(['date','type']).count()['amount'].unstack().plot(ax=ax)