13 lines
412 B
Python
13 lines
412 B
Python
import pandas as pd
|
|
from matplotlib import pyplot
|
|
from matplotlib.axes import Axes
|
|
|
|
df = pd.read_excel("sample-data-food-sales.xlsx", sheet_name="FoodSales")
|
|
groups = df.groupby(["Region", "City"])
|
|
averages = groups.mean(numeric_only=True)
|
|
|
|
axis: Axes = averages.plot.bar(rot=0)
|
|
for p in axis.patches:
|
|
axis.annotate(f"{p.get_height():.1f}", (p.get_x() + 0.05, p.get_height() + 5), rotation=90)
|
|
pyplot.show()
|