如何使用单个aggfunc格式化多个值的pivot_table输出。多个值应该并排出现
数据帧为:
kpi_date ssaname bts_name call_volume call_drop
0 2015-09-01 Bangalore 1002_NUc_Marathalli 8962 0.62
1 2015-09-03 Bangalore 1002_NUc_Marathalli 6567 1.19
2 2015-09-02 Bangalore 1002_NUc_Marathalli 7033 0.63
3 2015-09-01 Bangalore 1003_IU2_Munnekolalu 4659 1.17
4 2015-09-02 Bangalore 1003_IU2_Munnekolalu 6671 0.46
我希望输出为:
^{pr2}$使用pivot_表
这就是你要找的吗?注意:为了便于打印,我将列重命名为“call_v”和“call_d”。在
基本上是堆积后的物质的聚集。在
您可以使用groupby或pivot_table函数聚合call_volume和call_drop。在
Python代码:
输出:
^{pr2}$编辑
下面是将
kpi_date
作为列的代码相关问题 更多 >
编程相关推荐