0
在python
panda
,我怎样才能输出汇总统计到一个数据框没有一个变量组?如何输出不带变量组的汇总统计信息?
这是我的数据集 “表1”:
email Total_Orders Amount
[email protected] 5 150
[email protected]
[email protected] 4 69
[email protected] 2 30
我所需的输出是:
num_emails total_purchasers total_orders total amount
4 3 11 249
如果我有一个变量 “按组”,这是我会怎么做 -
Table2 = DataFrame(Table1.groupby(['category']).agg({'emails': 'count', 'total_orders': 'count', 'total_orders': np.sum, 'Amount': np.sum})).reset_index()
但我没有一个变量组,所以我该怎么做?