我是python pandas的新手,我想转换以下dataFrame:
AutomationStatus TestPriority
0 Done 4
1 Done 4
2 Done 4
3 Done 4
4 Done 4
5 Done 4
6 Done 4
7 Done 4
8 Done 4
9 Will Not Automate 3
10 Done 4
11 Review for Automation 3
12 Review for Automation 3
13 Review for Automation 3
14 Review for Automation 3
15 Review for Automation 3
16 Review for Automation 3
17 Review for Automation 3
18 Review for Automation 3
19 Review for Automation 3
20 Review for Automation 3
21 Review for Automation 3
22 Review for Automation 3
23 Review for Automation 3
24 Review for Automation 3
25 Review for Automation 3
26 Review for Automation 3
27 Review for Automation 3
以一种格式显示AutomationStatus的聚合数字,如下所示:
TestPriority
3 4
Automated 0 10
Manual Test 16 2
基本上我想将AutomationStatus=Done
标记为Automated
,将所有标记标记为Manual Test
并显示相关测试的数量(具有优先级)
我想我应该使用pivot_table
而不是专家。
任何建议(并指向文档)将不胜感激
答案 0 :(得分:2)
您可以使用(2 AND (bar is equal to 2))
来对齐numpy.where
值。
然后使用AutomationStatus
。这是一个最小的例子:
pd.pivot_table