Created
March 31, 2021 21:13
-
-
Save samirsaci/5c1b456b90fe75a7d6e36815f391c2d9 to your computer and use it in GitHub Desktop.
Pareto Process
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # BOX/SKU | |
| df_par = pd.DataFrame(df.groupby(['SKU'])['BOX'].sum()) | |
| df_par.columns = ['BOX'] | |
| # Sort Values | |
| df_par.sort_values(['BOX'], ascending = False, inplace = True) | |
| df_par.reset_index(inplace = True) | |
| # Cumulative Sum | |
| df_par['CumSum'] = df_par['BOX'].cumsum() | |
| # % CumSum | |
| df_par['%CumSum'] = (100 * df_par['CumSum']/df_par['BOX'].sum()) | |
| # % SKU | |
| df_par['%SKU'] = (100 * (df_par.index + 1).astype(float)/(df_par.index.max() + 1)) | |
| print("Pareto Analysis for {:,} unique SKU".format(len(df_par))) | |
| df_par.set_index('SKU').head() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment