![]() def create_pareto_chart(by_variable, quant_variable, threshold):ĭf = pd. In the Name edit box, type the name of the newly merged category. In the Less than value / edit box, type the frequency count or relative frequency threshold. More generalized version of ImportanceOfBeingErnest's code: def create_pareto_chart(df, by_variable, quant_variable):ĭf = quant_variable.cumsum()/quant_variable.sum()*100Īx.bar(df.index, quant_variable, color="C0")Īx2.plot(df.index, df, color="C1", marker="D", ms=7)Īx2.t_major_formatter(PercentFormatter())Īnd this one includes Pareto by grouping according to a threshold, too.įor example: If you set it to 70, it will group minorities beyond 70 into one group called "Other". To merge all the categories with a frequency less than a threshold: In the Combine group, select the Threshold option.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |