As of 0.23 version of Pandas, the solution would be: df2.pivot_table(values='X', index='Y', columns='Z', aggfunc=pd.Series.nunique). which returns:.
確定! 回上一頁