Use the pivot table:
import pandas as pd import numpy as np df = pd.DataFrame({'day_of_week':['Friday','Sunday','Monday','Sunday','Friday','Friday'], \ 'count':[200,300,100,50,110,90], 'ice_cream':['choco','vanilla','vanilla','choco','choco','straw'],\ 'proportion':[.9,.1,.2,.3,.8,.4]}) print df
Output:
count day_of_week ice_cream proportion 0 200 Friday choco 0.9 1 300 Sunday vanilla 0.1 2 100 Monday vanilla 0.2 3 50 Sunday choco 0.3 4 110 Friday choco 0.8 5 90 Friday straw 0.4 proportion ice_cream choco straw vanilla day_of_week Friday 0.85 0.4 NaN Monday NaN NaN 0.2 Sunday 0.30 NaN 0.1
source share