Apologies for the somewhat subjective question, but I was wondering if anyone could summarize the relative pros and cons of using GroupBy vs hierarchical indexing for working on groups of data within a single dataframe.
My project involves constructing a dataframe of typing data. Each row represents a single keystroke (letter, touch/release time, touch/release coordinates), being then organized by sentences (the first level of grouping), and then by day (the second level). I need to both select sentences by an index (day/sentence), as well as perform operations on the entire sentence group (such as mapping functions to these groups, as opposed to individual rows).
It seems that both GroupBy and hierarchical indexing have some benefits -- GroupBy seems to make it easier to perform calculations on the group level, while hierarchical indexing makes it easier to pluck specific phrases out of the dataframe for other purposes. Can anyone advise on which technique would be more appropriate? Or is some combination of the two the best way to go?
Thank you!
Edit: this question was marked as a duplicate of a question regarding working with hierarchical indexing, but it is not -- this question is concerned with hierarchical indexing vs another approach.