Why Pandas Transform fails if you only have a single column,df.groupby('a')['a'].transform('count')