Python Array Vs Dataframe Groupby