I have data such as the following:
I would suggest you check out this Stackoverflow question. I think that you will get the desirable answer there. Python Pandas counting and summing specific conditions
As for the high volume of data, I may recommend to look at the parallel data processing frameworks such as Dask, Modin,or Vaex. Check the differences between frameworks here in this blog.
Disclaimer: I don't own all above website. I think that those resources can answer the question better than I do.
1.4m articles
1.4m replys
5 comments
56.7k users