Hướng dẫn how do i convert a column to a percent in python? - làm cách nào để chuyển đổi một cột thành phần trăm trong python?

Tôi có một khung dữ liệu mà tôi đã tạo bởi một nhóm:

hmdf = pd.DataFrame[hm01]
new_hm01 = hmdf[['FinancialYear','Month','FirstReceivedDate']]

hm05 = new_hm01.pivot_table[index=['FinancialYear','Month'], aggfunc='count']
vals1 = ['April    ', 'May      ', 'June     ', 'July     ', 'August   ', 'September', 'October  ', 'November ', 'December ', 'January  ', 'February ', 'March    ']

df_hm = new_hm01.groupby[['Month', 'FinancialYear']].size[].unstack[fill_value=0].rename[columns=lambda x: '{}'.format[x]]
df_hml = df_hm.reindex[vals1]

DF trông như thế này:

FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
Month               
April               34          24          22          20
May                 29          26          21          25
June                19          39          22          20
July                23          39          18          20
August              36          30          34           0
September           35          23          41           0
October             36          37          27           0
November            38          31          30           0
December            36          41          23           0
January             34          30          35           0
February            37          26          37           0
March               36          31          33           0

Tên cột là từ các biến [threeYr,twoYr,oneYr,Yr] và tôi muốn chuyển đổi DataFrame để các số là tỷ lệ phần trăm của tổng số cho mỗi cột, nhưng tôi không thể làm cho nó hoạt động.

Đây là những gì tôi muốn:

FinancialYear       2014/2015   2015/2016   2016/2017   2017/2018
Month               
April                   9%          6%          6%         24%
May                     7%          7%          6%         29%
June                    5%         10%          6%         24%
July                    6%         10%          5%         24%
August                  9%          8%         10%          0%
September               9%          6%         12%          0%
October                 9%         10%          8%          0%
November               10%          8%          9%          0%
December                9%         11%          7%          0%
January                 9%          8%         10%          0%
February                9%          7%         11%          0%
March                   9%          8%         10%          0%

Bất cứ ai có thể giúp tôi làm điều này?

EDIT: Tôi đã thử phản hồi được tìm thấy tại liên kết này: Pandas chuyển đổi cột thành tỷ lệ phần trăm tổng số ..... Tôi không thể làm việc đó cho DataFrame của mình + nó không giải thích tốt [với tôi] làm thế nào để làm cho nó hoạt động bất kỳ df. Phản hồi từ John Galt tôi tin là tốt hơn phản hồi đó [ý kiến ​​của tôi].

Các

Ví dụ 2: & nbsp;

import pandas as pd

FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
Month               
April               34          24          22          20
May                 29          26          21          25
June                19          39          22          20
July                23          39          18          20
August              36          30          34           0
September           35          23          41           0
October             36          37          27           0
November            38          31          30           0
December            36          41          23           0
January             34          30          35           0
February            37          26          37           0
March               36          31          33           0
0____11
FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
Month               
April               34          24          22          20
May                 29          26          21          25
June                19          39          22          20
July                23          39          18          20
August              36          30          34           0
September           35          23          41           0
October             36          37          27           0
November            38          31          30           0
December            36          41          23           0
January             34          30          35           0
February            37          26          37           0
March               36          31          33           0
2

 1|  INPUT:
 2|  
 3|  	col_1	col_2
 4|  0	43	120
 5|  1	25	3
 6|  2	67	19
 7|  3	86	34
 8|  
 9|  df['total'] = df['col_1'] + df['col_2']
10|  df = df.pipe[lambda x: x.div[x['total'], axis='index']].applymap['{:.0%}'.format]
11|  
12|  OUPUT:
13|  
14|  	col_1	col_2	total
15|  0	26%	74%	100%
16|  1	89%	11%	100%
17|  2	78%	22%	100%
18|  3	72%	28%	100%

Các

Các

Ví dụ 2: & nbsp;

  • Các
  • Các

    Ví dụ 2: & nbsp;

    Các Percentage is calculated by the mathematical formula of dividing the value by the sum of all the values and then multiplying the sum by 100. This is also applicable in Pandas Dataframes. Here, the pre-defined sum[] method of pandas series is used to compute the sum of all the values of a column.

    Cú pháp: series.sum []Series.sum[]

    Trả về: Trả về tổng của các giá trị. Returns the sum of the values.

    Formula: 

    df[percent] = [df['column_name'] / df['column_name'].sum[]] * 100
    

    Ví dụ 1: & nbsp; 

    Python3

    import pandas as pd

    import numpy as np

    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    0____11
    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    2

    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    3
    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    4
    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    5
    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    6
    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    7
    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    8
    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    7
    FinancialYear       2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April                   9%          6%          6%         24%
    May                     7%          7%          6%         29%
    June                    5%         10%          6%         24%
    July                    6%         10%          5%         24%
    August                  9%          8%         10%          0%
    September               9%          6%         12%          0%
    October                 9%         10%          8%          0%
    November               10%          8%          9%          0%
    December                9%         11%          7%          0%
    January                 9%          8%         10%          0%
    February                9%          7%         11%          0%
    March                   9%          8%         10%          0%
    
    0
    FinancialYear       2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April                   9%          6%          6%         24%
    May                     7%          7%          6%         29%
    June                    5%         10%          6%         24%
    July                    6%         10%          5%         24%
    August                  9%          8%         10%          0%
    September               9%          6%         12%          0%
    October                 9%         10%          8%          0%
    November               10%          8%          9%          0%
    December                9%         11%          7%          0%
    January                 9%          8%         10%          0%
    February                9%          7%         11%          0%
    March                   9%          8%         10%          0%
    
    1

    FinancialYear       2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April                   9%          6%          6%         24%
    May                     7%          7%          6%         29%
    June                    5%         10%          6%         24%
    July                    6%         10%          5%         24%
    August                  9%          8%         10%          0%
    September               9%          6%         12%          0%
    October                 9%         10%          8%          0%
    November               10%          8%          9%          0%
    December                9%         11%          7%          0%
    January                 9%          8%         10%          0%
    February                9%          7%         11%          0%
    March                   9%          8%         10%          0%
    
    2
    FinancialYear       2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April                   9%          6%          6%         24%
    May                     7%          7%          6%         29%
    June                    5%         10%          6%         24%
    July                    6%         10%          5%         24%
    August                  9%          8%         10%          0%
    September               9%          6%         12%          0%
    October                 9%         10%          8%          0%
    November               10%          8%          9%          0%
    December                9%         11%          7%          0%
    January                 9%          8%         10%          0%
    February                9%          7%         11%          0%
    March                   9%          8%         10%          0%
    
    3
    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    7
    FinancialYear       2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April                   9%          6%          6%         24%
    May                     7%          7%          6%         29%
    June                    5%         10%          6%         24%
    July                    6%         10%          5%         24%
    August                  9%          8%         10%          0%
    September               9%          6%         12%          0%
    October                 9%         10%          8%          0%
    November               10%          8%          9%          0%
    December                9%         11%          7%          0%
    January                 9%          8%         10%          0%
    February                9%          7%         11%          0%
    March                   9%          8%         10%          0%
    
    5
    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    7
    FinancialYear       2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April                   9%          6%          6%         24%
    May                     7%          7%          6%         29%
    June                    5%         10%          6%         24%
    July                    6%         10%          5%         24%
    August                  9%          8%         10%          0%
    September               9%          6%         12%          0%
    October                 9%         10%          8%          0%
    November               10%          8%          9%          0%
    December                9%         11%          7%          0%
    January                 9%          8%         10%          0%
    February                9%          7%         11%          0%
    March                   9%          8%         10%          0%
    
    7
    FinancialYear       2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April                   9%          6%          6%         24%
    May                     7%          7%          6%         29%
    June                    5%         10%          6%         24%
    July                    6%         10%          5%         24%
    August                  9%          8%         10%          0%
    September               9%          6%         12%          0%
    October                 9%         10%          8%          0%
    November               10%          8%          9%          0%
    December                9%         11%          7%          0%
    January                 9%          8%         10%          0%
    February                9%          7%         11%          0%
    March                   9%          8%         10%          0%
    
    1

    FinancialYear       2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April                   9%          6%          6%         24%
    May                     7%          7%          6%         29%
    June                    5%         10%          6%         24%
    July                    6%         10%          5%         24%
    August                  9%          8%         10%          0%
    September               9%          6%         12%          0%
    October                 9%         10%          8%          0%
    November               10%          8%          9%          0%
    December                9%         11%          7%          0%
    January                 9%          8%         10%          0%
    February                9%          7%         11%          0%
    March                   9%          8%         10%          0%
    
    2
     1|  INPUT:
     2|  
     3|  	col_1	col_2
     4|  0	43	120
     5|  1	25	3
     6|  2	67	19
     7|  3	86	34
     8|  
     9|  df['total'] = df['col_1'] + df['col_2']
    10|  df = df.pipe[lambda x: x.div[x['total'], axis='index']].applymap['{:.0%}'.format]
    11|  
    12|  OUPUT:
    13|  
    14|  	col_1	col_2	total
    15|  0	26%	74%	100%
    16|  1	89%	11%	100%
    17|  2	78%	22%	100%
    18|  3	72%	28%	100%
    
    0
     1|  INPUT:
     2|  
     3|  	col_1	col_2
     4|  0	43	120
     5|  1	25	3
     6|  2	67	19
     7|  3	86	34
     8|  
     9|  df['total'] = df['col_1'] + df['col_2']
    10|  df = df.pipe[lambda x: x.div[x['total'], axis='index']].applymap['{:.0%}'.format]
    11|  
    12|  OUPUT:
    13|  
    14|  	col_1	col_2	total
    15|  0	26%	74%	100%
    16|  1	89%	11%	100%
    17|  2	78%	22%	100%
    18|  3	72%	28%	100%
    
    1

    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    3
     1|  INPUT:
     2|  
     3|  	col_1	col_2
     4|  0	43	120
     5|  1	25	3
     6|  2	67	19
     7|  3	86	34
     8|  
     9|  df['total'] = df['col_1'] + df['col_2']
    10|  df = df.pipe[lambda x: x.div[x['total'], axis='index']].applymap['{:.0%}'.format]
    11|  
    12|  OUPUT:
    13|  
    14|  	col_1	col_2	total
    15|  0	26%	74%	100%
    16|  1	89%	11%	100%
    17|  2	78%	22%	100%
    18|  3	72%	28%	100%
    
    3
    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    5
     1|  INPUT:
     2|  
     3|  	col_1	col_2
     4|  0	43	120
     5|  1	25	3
     6|  2	67	19
     7|  3	86	34
     8|  
     9|  df['total'] = df['col_1'] + df['col_2']
    10|  df = df.pipe[lambda x: x.div[x['total'], axis='index']].applymap['{:.0%}'.format]
    11|  
    12|  OUPUT:
    13|  
    14|  	col_1	col_2	total
    15|  0	26%	74%	100%
    16|  1	89%	11%	100%
    17|  2	78%	22%	100%
    18|  3	72%	28%	100%
    
    5
    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    7
     1|  INPUT:
     2|  
     3|  	col_1	col_2
     4|  0	43	120
     5|  1	25	3
     6|  2	67	19
     7|  3	86	34
     8|  
     9|  df['total'] = df['col_1'] + df['col_2']
    10|  df = df.pipe[lambda x: x.div[x['total'], axis='index']].applymap['{:.0%}'.format]
    11|  
    12|  OUPUT:
    13|  
    14|  	col_1	col_2	total
    15|  0	26%	74%	100%
    16|  1	89%	11%	100%
    17|  2	78%	22%	100%
    18|  3	72%	28%	100%
    
    7
    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    7
     1|  INPUT:
     2|  
     3|  	col_1	col_2
     4|  0	43	120
     5|  1	25	3
     6|  2	67	19
     7|  3	86	34
     8|  
     9|  df['total'] = df['col_1'] + df['col_2']
    10|  df = df.pipe[lambda x: x.div[x['total'], axis='index']].applymap['{:.0%}'.format]
    11|  
    12|  OUPUT:
    13|  
    14|  	col_1	col_2	total
    15|  0	26%	74%	100%
    16|  1	89%	11%	100%
    17|  2	78%	22%	100%
    18|  3	72%	28%	100%
    
    9
    FinancialYear       2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April                   9%          6%          6%         24%
    May                     7%          7%          6%         29%
    June                    5%         10%          6%         24%
    July                    6%         10%          5%         24%
    August                  9%          8%         10%          0%
    September               9%          6%         12%          0%
    October                 9%         10%          8%          0%
    November               10%          8%          9%          0%
    December                9%         11%          7%          0%
    January                 9%          8%         10%          0%
    February                9%          7%         11%          0%
    March                   9%          8%         10%          0%
    
    1

    df[percent] = [df['column_name'] / df['column_name'].sum[]] * 100
    
    1
    df[percent] = [df['column_name'] / df['column_name'].sum[]] * 100
    
    2
    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    7
    df[percent] = [df['column_name'] / df['column_name'].sum[]] * 100
    
    4
    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    7
    df[percent] = [df['column_name'] / df['column_name'].sum[]] * 100
    
    6
    FinancialYear       2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April                   9%          6%          6%         24%
    May                     7%          7%          6%         29%
    June                    5%         10%          6%         24%
    July                    6%         10%          5%         24%
    August                  9%          8%         10%          0%
    September               9%          6%         12%          0%
    October                 9%         10%          8%          0%
    November               10%          8%          9%          0%
    December                9%         11%          7%          0%
    January                 9%          8%         10%          0%
    February                9%          7%         11%          0%
    March                   9%          8%         10%          0%
    
    1

    df[percent] = [df['column_name'] / df['column_name'].sum[]] * 100
    
    1
    df[percent] = [df['column_name'] / df['column_name'].sum[]] * 100
    
    9[threeYr,twoYr,oneYr,Yr]0

    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    0____11 [threeYr,twoYr,oneYr,Yr]3

    df[percent] = [df['column_name'] / df['column_name'].sum[]] * 100
    
    1[threeYr,twoYr,oneYr,Yr]5
    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    1 [threeYr,twoYr,oneYr,Yr]7
    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    4
    FinancialYear       2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April                   9%          6%          6%         24%
    May                     7%          7%          6%         29%
    June                    5%         10%          6%         24%
    July                    6%         10%          5%         24%
    August                  9%          8%         10%          0%
    September               9%          6%         12%          0%
    October                 9%         10%          8%          0%
    November               10%          8%          9%          0%
    December                9%         11%          7%          0%
    January                 9%          8%         10%          0%
    February                9%          7%         11%          0%
    March                   9%          8%         10%          0%
    
    1

    import0

     1|  INPUT:
     2|  
     3|  	col_1	col_2
     4|  0	43	120
     5|  1	25	3
     6|  2	67	19
     7|  3	86	34
     8|  
     9|  df['total'] = df['col_1'] + df['col_2']
    10|  df = df.pipe[lambda x: x.div[x['total'], axis='index']].applymap['{:.0%}'.format]
    11|  
    12|  OUPUT:
    13|  
    14|  	col_1	col_2	total
    15|  0	26%	74%	100%
    16|  1	89%	11%	100%
    17|  2	78%	22%	100%
    18|  3	72%	28%	100%
    
    3import2

    Các

    pandas as pd9

    Output:   
     

    Ví dụ 2: & nbsp; 

    Python3

    import pandas as pd

    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    0____11
    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    2

    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    3
    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    4
    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    5
    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    6
    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    7
    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    8
    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    7
    FinancialYear       2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April                   9%          6%          6%         24%
    May                     7%          7%          6%         29%
    June                    5%         10%          6%         24%
    July                    6%         10%          5%         24%
    August                  9%          8%         10%          0%
    September               9%          6%         12%          0%
    October                 9%         10%          8%          0%
    November               10%          8%          9%          0%
    December                9%         11%          7%          0%
    January                 9%          8%         10%          0%
    February                9%          7%         11%          0%
    March                   9%          8%         10%          0%
    
    0
    FinancialYear       2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April                   9%          6%          6%         24%
    May                     7%          7%          6%         29%
    June                    5%         10%          6%         24%
    July                    6%         10%          5%         24%
    August                  9%          8%         10%          0%
    September               9%          6%         12%          0%
    October                 9%         10%          8%          0%
    November               10%          8%          9%          0%
    December                9%         11%          7%          0%
    January                 9%          8%         10%          0%
    February                9%          7%         11%          0%
    March                   9%          8%         10%          0%
    
    1

    FinancialYear       2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April                   9%          6%          6%         24%
    May                     7%          7%          6%         29%
    June                    5%         10%          6%         24%
    July                    6%         10%          5%         24%
    August                  9%          8%         10%          0%
    September               9%          6%         12%          0%
    October                 9%         10%          8%          0%
    November               10%          8%          9%          0%
    December                9%         11%          7%          0%
    January                 9%          8%         10%          0%
    February                9%          7%         11%          0%
    March                   9%          8%         10%          0%
    
    2
    FinancialYear       2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April                   9%          6%          6%         24%
    May                     7%          7%          6%         29%
    June                    5%         10%          6%         24%
    July                    6%         10%          5%         24%
    August                  9%          8%         10%          0%
    September               9%          6%         12%          0%
    October                 9%         10%          8%          0%
    November               10%          8%          9%          0%
    December                9%         11%          7%          0%
    January                 9%          8%         10%          0%
    February                9%          7%         11%          0%
    March                   9%          8%         10%          0%
    
    3
    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    7
    FinancialYear       2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April                   9%          6%          6%         24%
    May                     7%          7%          6%         29%
    June                    5%         10%          6%         24%
    July                    6%         10%          5%         24%
    August                  9%          8%         10%          0%
    September               9%          6%         12%          0%
    October                 9%         10%          8%          0%
    November               10%          8%          9%          0%
    December                9%         11%          7%          0%
    January                 9%          8%         10%          0%
    February                9%          7%         11%          0%
    March                   9%          8%         10%          0%
    
    5
    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    7
    FinancialYear       2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April                   9%          6%          6%         24%
    May                     7%          7%          6%         29%
    June                    5%         10%          6%         24%
    July                    6%         10%          5%         24%
    August                  9%          8%         10%          0%
    September               9%          6%         12%          0%
    October                 9%         10%          8%          0%
    November               10%          8%          9%          0%
    December                9%         11%          7%          0%
    January                 9%          8%         10%          0%
    February                9%          7%         11%          0%
    March                   9%          8%         10%          0%
    
    7
    FinancialYear       2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April                   9%          6%          6%         24%
    May                     7%          7%          6%         29%
    June                    5%         10%          6%         24%
    July                    6%         10%          5%         24%
    August                  9%          8%         10%          0%
    September               9%          6%         12%          0%
    October                 9%         10%          8%          0%
    November               10%          8%          9%          0%
    December                9%         11%          7%          0%
    January                 9%          8%         10%          0%
    February                9%          7%         11%          0%
    March                   9%          8%         10%          0%
    
    1

    FinancialYear       2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April                   9%          6%          6%         24%
    May                     7%          7%          6%         29%
    June                    5%         10%          6%         24%
    July                    6%         10%          5%         24%
    August                  9%          8%         10%          0%
    September               9%          6%         12%          0%
    October                 9%         10%          8%          0%
    November               10%          8%          9%          0%
    December                9%         11%          7%          0%
    January                 9%          8%         10%          0%
    February                9%          7%         11%          0%
    March                   9%          8%         10%          0%
    
    2
     1|  INPUT:
     2|  
     3|  	col_1	col_2
     4|  0	43	120
     5|  1	25	3
     6|  2	67	19
     7|  3	86	34
     8|  
     9|  df['total'] = df['col_1'] + df['col_2']
    10|  df = df.pipe[lambda x: x.div[x['total'], axis='index']].applymap['{:.0%}'.format]
    11|  
    12|  OUPUT:
    13|  
    14|  	col_1	col_2	total
    15|  0	26%	74%	100%
    16|  1	89%	11%	100%
    17|  2	78%	22%	100%
    18|  3	72%	28%	100%
    
    0
     1|  INPUT:
     2|  
     3|  	col_1	col_2
     4|  0	43	120
     5|  1	25	3
     6|  2	67	19
     7|  3	86	34
     8|  
     9|  df['total'] = df['col_1'] + df['col_2']
    10|  df = df.pipe[lambda x: x.div[x['total'], axis='index']].applymap['{:.0%}'.format]
    11|  
    12|  OUPUT:
    13|  
    14|  	col_1	col_2	total
    15|  0	26%	74%	100%
    16|  1	89%	11%	100%
    17|  2	78%	22%	100%
    18|  3	72%	28%	100%
    
    1

    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    04
     1|  INPUT:
     2|  
     3|  	col_1	col_2
     4|  0	43	120
     5|  1	25	3
     6|  2	67	19
     7|  3	86	34
     8|  
     9|  df['total'] = df['col_1'] + df['col_2']
    10|  df = df.pipe[lambda x: x.div[x['total'], axis='index']].applymap['{:.0%}'.format]
    11|  
    12|  OUPUT:
    13|  
    14|  	col_1	col_2	total
    15|  0	26%	74%	100%
    16|  1	89%	11%	100%
    17|  2	78%	22%	100%
    18|  3	72%	28%	100%
    
    3
    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    5
     1|  INPUT:
     2|  
     3|  	col_1	col_2
     4|  0	43	120
     5|  1	25	3
     6|  2	67	19
     7|  3	86	34
     8|  
     9|  df['total'] = df['col_1'] + df['col_2']
    10|  df = df.pipe[lambda x: x.div[x['total'], axis='index']].applymap['{:.0%}'.format]
    11|  
    12|  OUPUT:
    13|  
    14|  	col_1	col_2	total
    15|  0	26%	74%	100%
    16|  1	89%	11%	100%
    17|  2	78%	22%	100%
    18|  3	72%	28%	100%
    
    5
    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    7
     1|  INPUT:
     2|  
     3|  	col_1	col_2
     4|  0	43	120
     5|  1	25	3
     6|  2	67	19
     7|  3	86	34
     8|  
     9|  df['total'] = df['col_1'] + df['col_2']
    10|  df = df.pipe[lambda x: x.div[x['total'], axis='index']].applymap['{:.0%}'.format]
    11|  
    12|  OUPUT:
    13|  
    14|  	col_1	col_2	total
    15|  0	26%	74%	100%
    16|  1	89%	11%	100%
    17|  2	78%	22%	100%
    18|  3	72%	28%	100%
    
    7
    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    7
     1|  INPUT:
     2|  
     3|  	col_1	col_2
     4|  0	43	120
     5|  1	25	3
     6|  2	67	19
     7|  3	86	34
     8|  
     9|  df['total'] = df['col_1'] + df['col_2']
    10|  df = df.pipe[lambda x: x.div[x['total'], axis='index']].applymap['{:.0%}'.format]
    11|  
    12|  OUPUT:
    13|  
    14|  	col_1	col_2	total
    15|  0	26%	74%	100%
    16|  1	89%	11%	100%
    17|  2	78%	22%	100%
    18|  3	72%	28%	100%
    
    9
    FinancialYear       2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April                   9%          6%          6%         24%
    May                     7%          7%          6%         29%
    June                    5%         10%          6%         24%
    July                    6%         10%          5%         24%
    August                  9%          8%         10%          0%
    September               9%          6%         12%          0%
    October                 9%         10%          8%          0%
    November               10%          8%          9%          0%
    December                9%         11%          7%          0%
    January                 9%          8%         10%          0%
    February                9%          7%         11%          0%
    March                   9%          8%         10%          0%
    
    1

    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    13
    df[percent] = [df['column_name'] / df['column_name'].sum[]] * 100
    
    2
    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    7
    df[percent] = [df['column_name'] / df['column_name'].sum[]] * 100
    
    4
    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    7
    df[percent] = [df['column_name'] / df['column_name'].sum[]] * 100
    
    6
    FinancialYear       2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April                   9%          6%          6%         24%
    May                     7%          7%          6%         29%
    June                    5%         10%          6%         24%
    July                    6%         10%          5%         24%
    August                  9%          8%         10%          0%
    September               9%          6%         12%          0%
    October                 9%         10%          8%          0%
    November               10%          8%          9%          0%
    December                9%         11%          7%          0%
    January                 9%          8%         10%          0%
    February                9%          7%         11%          0%
    March                   9%          8%         10%          0%
    
    1

    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    13
    df[percent] = [df['column_name'] / df['column_name'].sum[]] * 100
    
    9
     1|  INPUT:
     2|  
     3|  	col_1	col_2
     4|  0	43	120
     5|  1	25	3
     6|  2	67	19
     7|  3	86	34
     8|  
     9|  df['total'] = df['col_1'] + df['col_2']
    10|  df = df.pipe[lambda x: x.div[x['total'], axis='index']].applymap['{:.0%}'.format]
    11|  
    12|  OUPUT:
    13|  
    14|  	col_1	col_2	total
    15|  0	26%	74%	100%
    16|  1	89%	11%	100%
    17|  2	78%	22%	100%
    18|  3	72%	28%	100%
    
    1

    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    0____11 [threeYr,twoYr,oneYr,Yr]3

    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    13
    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    33
    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    7
    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    35
    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    7
    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    37
    FinancialYear       2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April                   9%          6%          6%         24%
    May                     7%          7%          6%         29%
    June                    5%         10%          6%         24%
    July                    6%         10%          5%         24%
    August                  9%          8%         10%          0%
    September               9%          6%         12%          0%
    October                 9%         10%          8%          0%
    November               10%          8%          9%          0%
    December                9%         11%          7%          0%
    January                 9%          8%         10%          0%
    February                9%          7%         11%          0%
    March                   9%          8%         10%          0%
    
    1

    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    13
    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    40
    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    41

    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    42

    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    0____11 [threeYr,twoYr,oneYr,Yr]3

    df[percent] = [df['column_name'] / df['column_name'].sum[]] * 100
    
    1[threeYr,twoYr,oneYr,Yr]5
    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    1 [threeYr,twoYr,oneYr,Yr]7
    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    4
    FinancialYear       2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April                   9%          6%          6%         24%
    May                     7%          7%          6%         29%
    June                    5%         10%          6%         24%
    July                    6%         10%          5%         24%
    August                  9%          8%         10%          0%
    September               9%          6%         12%          0%
    October                 9%         10%          8%          0%
    November               10%          8%          9%          0%
    December                9%         11%          7%          0%
    January                 9%          8%         10%          0%
    February                9%          7%         11%          0%
    March                   9%          8%         10%          0%
    
    1

    df[percent] = [df['column_name'] / df['column_name'].sum[]] * 100
    
    1
     1|  INPUT:
     2|  
     3|  	col_1	col_2
     4|  0	43	120
     5|  1	25	3
     6|  2	67	19
     7|  3	86	34
     8|  
     9|  df['total'] = df['col_1'] + df['col_2']
    10|  df = df.pipe[lambda x: x.div[x['total'], axis='index']].applymap['{:.0%}'.format]
    11|  
    12|  OUPUT:
    13|  
    14|  	col_1	col_2	total
    15|  0	26%	74%	100%
    16|  1	89%	11%	100%
    17|  2	78%	22%	100%
    18|  3	72%	28%	100%
    
    3
    FinancialYear       2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April                   9%          6%          6%         24%
    May                     7%          7%          6%         29%
    June                    5%         10%          6%         24%
    July                    6%         10%          5%         24%
    August                  9%          8%         10%          0%
    September               9%          6%         12%          0%
    October                 9%         10%          8%          0%
    November               10%          8%          9%          0%
    December                9%         11%          7%          0%
    January                 9%          8%         10%          0%
    February                9%          7%         11%          0%
    March                   9%          8%         10%          0%
    
    1
    FinancialYear   2014/2015   2015/2016   2016/2017   2017/2018
    Month               
    April               34          24          22          20
    May                 29          26          21          25
    June                19          39          22          20
    July                23          39          18          20
    August              36          30          34           0
    September           35          23          41           0
    October             36          37          27           0
    November            38          31          30           0
    December            36          41          23           0
    January             34          30          35           0
    February            37          26          37           0
    March               36          31          33           0
    
    24import2

    import0

     1|  INPUT:
     2|  
     3|  	col_1	col_2
     4|  0	43	120
     5|  1	25	3
     6|  2	67	19
     7|  3	86	34
     8|  
     9|  df['total'] = df['col_1'] + df['col_2']
    10|  df = df.pipe[lambda x: x.div[x['total'], axis='index']].applymap['{:.0%}'.format]
    11|  
    12|  OUPUT:
    13|  
    14|  	col_1	col_2	total
    15|  0	26%	74%	100%
    16|  1	89%	11%	100%
    17|  2	78%	22%	100%
    18|  3	72%	28%	100%
    
    3import2

    pandas as pd9

    Output:   
     


    Bài Viết Liên Quan

    Chủ Đề