df.pivot_table
在数据透视表之后,计算各分类占比百分数
table2=table.sum(axis=1,skipna = True) #dataframe 每行求和df=table.div(table2,axis='rows') #计算占比并存为新的dataframe