Member-only story
Crosstab Or Pivot Table (In Pandas) Deciding When to Use Which
Deciding Between Cross Tabulation & Pivot Table Can Be Confusing
Overview
Many of Pandas features can produce similar results. The apparent ambiguity can be confusing and frustrating for beginner and experienced users alike. This article compares pd.crosstab
with pd.pivot_table
in an effort to help you see how each will perform differently.
For this demonstration I will reference a personal data source: My posting activity on LinkedIn. This related article shows how to find and access this data for yourself.
The Data
If you’re here for heat map advice: Browse to the end of the article for a code excerpt that produces the optimal heat map displayed below.
The following are the first five records in my shares.csv
file which you can download from LinkedIn.
I began my life on LinkedIn in 2010 (or sooner). My first post was “Whistle while your work. Make it happen!” I have no…