How to Collapse Multiple Columns in Pandas? Groupby with Dictionary

Often you may want to collapse two or multiple columns in a Pandas data frame into one column. For example, you may have a data frame with data for each year as columns and you might want to get a new column which summarizes multiple columns. One may need to have flexibility of collapsing columns… Continue reading How to Collapse Multiple Columns in Pandas? Groupby with Dictionary

Pandas GroupBy: Introduction to Split-Apply-Combine

split apply combine example in Pandas

In a classic paper published at 2011, Hadley Wickham asked What do we do when we analyze data? What are common actions and what are common mistakes? And then went ahead to spell it out one of the most common strategies, Split-Apply-Combine, that is used in common data analysis. Intuitively, while solving a big problem,… Continue reading Pandas GroupBy: Introduction to Split-Apply-Combine