I have a Pandas Dataframe which I got from an SQL Output via MySQL.Connector which looks like the following:
Group Sales Period
0 0 136471.06 2015-1
1 0 645949.37 2015-2
2 0 1414552.66 2015-3
3 0 684672.48 2015-4
4 0 71529.99 2016-1
... ... ... ...
303 119 18641.06 2018-1
304 119 18514.82 2018-2
305 119 16042.67 2018-3
306 119 15043.29 2019-3
307 119 0.00 2020-2
The customers belong to a specific group. From this groups I have the quarterly (period) sales report.
How can I manage plotting the development of each group for each period in a line diagram? So far I've only managed it doing it manually like this:
plt.rcParams["figure.figsize"] = (20,10)
group_0 = df_4[df_4.Group == 0]
group_100 = df_4[df_4.Group == 100]
group_101 = df_4[df_4.Group == 101]
plt.plot(group_0.Period, group_0.Sales)
plt.plot(group_100.Period, group_100.Sales)
plt.plot(group_101.Period, group_101.Sales)
plt.legend(['0', '100', '101'])
plt.title("Sales per Group per Quarter")
plt.xlabel("Quarter")
plt.ylabel("Sales in Million")
plt.show()
Which gives me the output I need, but I assume there must be a better way. Other attempts with plotting the whole dataframe just gives me quite weird plotting-results. The attached image is the manual attempt which is good, but inefficient. So basically I'm looking for a solution attempt to get this done more efficiently. Any help is welcome

