The hard part is parsing your gmail.mbox file from google takeout. You can use `egrep '^From [0-9]|X-Gmail-Labels' gmail.mbox` as a good starting place for finding the labels and dates for each email. Personally, once I had the data I stored that data in a SQL database and ran an aggregate query to count the emails for each label every month.