https://llego.dev/posts/python-aggregate-statistics-pandas/