How to annotate bars with values on Python Pandas bar plots?

To annotate bars with values on Python Pandas bar plots, we call the annotate metthod.

For instance, we write

for p in ax.patches:
    ax.annotate(str(p.get_height()), (p.get_x() * 1.005, p.get_height() * 1.005))

to loop through the axes ax patches with ax.patches with a for loop.

Then we call ax.annotate to add the anootation for each patch by calling it with the position of the annotation.