I have tried to add new column to pivot table using python to show the percentage of parent raw. This is the code I used
pt_name = 'Automation' # must be a string
pt_rows = ['lmsp','days_to_breach_pt'] # must be a list
pt_cols = ['cp_flag'] # must be a list
pt_filters = ['origin_type'] # must be a list
# [0]: field name [1]: pivot table column name [3]: calulation method [4]: number format
pt_fields = [['tracking_number', 'TN', win32c.xlCount, '0'],
['tracking_number', '%', win32c.xlPercentOfParentRow, '0.00%']]
pivot_table(wb, ws1, ws2, ws2_name, pt_name, pt_rows, pt_cols, pt_filters, pt_fields)
But I am getting an error. enter image description here
Can someone help mw to solve the issue?