Here's what I have (Pandas DataFrame), that I created so far: Code:
table = pd.pivot_table(df1, index=['Assignee', 'IssueType'], columns=['Status'], values='Key', aggfunc={'Key': np.count_nonzero}, dropna=True)
table['Total'] = table.sum(axis=1)
table = table.fillna(0)
table = table.apply(pd.to_numeric, errors='ignore')
table = table.astype(int)
table.to_csv(output_file_path, sep=delimiter)
Output:
Assignee~IssueType~Analysis~Blocked~Closed~Done~In Progress~Open~Ready For QA Testing~Total
Smith, John~Story~0~0~0~0~0~1~0~1
Smith, John~Sub-task~0~0~0~0~0~1~0~1
Smith, John~Task~0~0~0~0~2~5~0~7
Doe, Jane~Bug~0~0~0~0~1~0~0~1
Polo, Marco~Bug~0~0~0~0~0~2~0~2
Polo, Marco~Story~0~0~1~0~0~0~0~1
Polo, Marco~Task~1~0~0~0~4~2~0~7
Here's what I would like to have (considering that I could have numeric/non-numeric columns:
Assignee~IssueType~Analysis~Blocked~Closed~Done~In Progress~Open~Ready For QA Testing~Total
Smith, John~Story~0~0~0~0~0~1~0~1
Smith, John~Sub-task~0~0~0~0~0~1~0~1
Smith, John~Task~0~0~0~0~2~5~0~7
Doe, Jane~Bug~0~0~0~0~1~0~0~1
Polo, Marco~Bug~0~0~0~0~0~2~0~2
Polo, Marco~Story~0~0~1~0~0~0~0~1
Polo, Marco~Task~1~0~0~0~4~2~0~7
**GrandTotal~GrandTotal~1~0~1~0~7~11~0~20**
What would be the best/optimal way to achieve this using Pandas DataFrames? Appreciate your help in advance.