Converting a Pandas GroupBy output from Series to DataFrame

后端 未结 9 753
广开言路
广开言路 2020-11-22 09:58

I\'m starting with input data like this

df1 = pandas.DataFrame( { 
    \"Name\" : [\"Alice\", \"Bob\", \"Mallory\", \"Mallory\", \"Bob\" , \"Mallory\"] , 
           


        
9条回答
  •  天命终不由人
    2020-11-22 10:47

    I have aggregated with Qty wise data and store to dataframe

    almo_grp_data = pd.DataFrame({'Qty_cnt' :
    almo_slt_models_data.groupby( ['orderDate','Item','State Abv']
              )['Qty'].sum()}).reset_index()
    

提交回复
热议问题