我在Pandas中有一个数据框,看起来像这样:
Activity Name Activity Start Activity End
0 Phone 04:00 08:00
1 Lunch 08:00 08:30
2 Coffee 08:30 08:45
3 Phone 08:45 10:30
4 WrittenSupport 10:30 12:30
5 Phone 04:00 08:00
6 Lunch 08:00 08:30
7 Coffee 08:30 08:45
8 Phone 08:45 09:00
9 Phone 06:00 09:00
“我的数据框”中的数据描述了在轮班期间分配给代理的不同活动。问题是另一个带有代理的数据帧只有57个名称,而通常有4-5个活动分配给一个人。当我合并我的数据帧时,我最终得到57个代理和265个显然与指定人员不匹配的活动。在
什么是有用的:每个人工作8小时。在
如何将其转换为这样:
^{pr2}$
也许可以通过创建一个不同索引的列表来实现,如下所示:
然后设置测向:
^{pr2}$如果您的代理和活动有单独的行,您可以创建一个多索引,如下所示:
输出:
^{pr2}$考虑以下数据(添加一些数据以供验证):
使用以下方法:
^{pr2}$相关问题 更多 >
编程相关推荐