groupby ([ 'cohort' , 'order_period' ]) cohorts = grouped_cohort . Columns became rows, and rows are now columns - notice that cohort periods in the data frame head are in rows, which makes reading the data a bit harder at a glance. groupby ([ 'cohort' , 'order_period' ]) cohorts = grouped_cohort .