show % of parent raw total in a pivot table

Viewed 25

I need to create my pivot table as mentioned in the image using python. Here TN is the count value and '%' marks shows the percentage value. Can someone help with this? [enter image description here][1]

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', 'TNM', win32c.xlPercentOfParentRow,'0.00%']]

[enter image description here][2]

This is the code part that I tried and this is the error that I got. [1]: https://i.stack.imgur.com/IiVhl.png [2]: https://i.stack.imgur.com/tf5Y4.png

0 Answers
Related