Package: asalix
ASALIXis aPythonpackage that collectsmathematical tools and utilitiesdesigned to supportLean Six
Sigma practitionersin their process improvement journey. This repository aims to provide a robustset of tools for
data analysis and statistical modeling.Whether you are a Lean Six Sigma professional, a data analyst, or someone interested in process improvement,ASALIXoffers a wide range of functions and modules to aid you in your Lean Six Sigma projects.1. InstallationTo use theASALIXlibrary, you'll need to have Python installed on your system. You can installASALIXusing
pip:pipinstallasalix2. Examples2.1 Extract dataset from Pandas DataFrameimportpandasaspdimportnumpyasnpfromasaliximport__init__asaxdataset=ax.extract_dataset(pd.DataFrame({"normal_dataset":np.random.normal(10,2,1000),"not_normal_dataset":list(range(0,1000))}),data_column_name="normal_dataset")2.1 Calculate mean value and standard deviationimportpandasaspdimportnumpyasnpimportasalixasax# Extract the dataset from a Pandas Dataframe that contains normal and not normal datadataset=ax.extract_dataset(pd.DataFrame({"normal_dataset":np.random.normal(10,2,1000),"not_normal_dataset":list(range(0,1000))}),data_column_name="normal_dataset")# Print the calculated mean values on screenprint("\nMean value")print("\u03BC:   ",ax.calculate_mean_value(dataset))# Population mean valueprint("xbar:",ax.calculate_mean_value(dataset))# Sample mean value# Print the calculated standard deviation on screenprint("\nStandard deviation")print("\u03C3:",ax.calculate_standard_deviation(dataset,population=True))# Population standard deviationprint("s:",ax.calculate_standard_deviation(dataset,population=False))# Sample standard deviation2.2 Perform normality testimportpandasaspdimportnumpyasnpimportasalixasax# Extract the dataset from a Pandas Dataframe that contains normal and not normal datadataset=ax.extract_dataset(pd.DataFrame({"normal_dataset":np.random.normal(10,2,1000),"not_normal_dataset":list(range(0,1000))}),data_column_name="normal_dataset")# Print the p-value of different normality test on screenprint("\nNormality test (P-value)")print("Basic:              ",ax.normality_test(dataset))print("Anderson-Darling:   ",ax.normality_test(dataset,test="anderson_darling"))print("Kolmogorov-Smirnov: ",ax.normality_test(dataset,test="kolmogorov_smirnov"))print("Shapiro-Wilk:       ",ax.normality_test(dataset,test="shapiro_wilk"))2.3 Fit dataset with normal distributionimportpandasaspdimportnumpyasnpimportasalixasax# Extract the dataset from a Pandas Dataframe that contains normal and not normal datadataset=ax.extract_dataset(pd.DataFrame({"normal_dataset":np.random.normal(10,2,1000),"not_normal_dataset":list(range(0,1000))}),data_column_name="normal_dataset")# Fit dataset with a normal distributionres=ax.normal_distribution_fit(dataset)print("\nNormal fit")print("p-value:",res.p_value)# p-valueprint("A:      ",res.normal_coefficient)# Coefficientprint("\u03BC:      ",res.mean_value)# Mean valueprint("\u03C3:      ",res.standard_deviation)# Standard deviation2.4 Plot data using histogramimportpandasaspdimportnumpyasnpimportasalixasax# Extract the dataset from a Pandas Dataframe that contains normal and not normal datadataset=ax.extract_dataset(pd.DataFrame({"normal_dataset":np.random.normal(10,2,1000),"not_normal_dataset":list(range(0,1000))}),data_column_name="normal_dataset")# Create the histogram with a normal distribution fitted curve and plot itax.create_histogram(dataset,normal_distribution_fitting=True,plot=True,density=False)2.5 Plot data using boxplot and calculate quartilesimportpandasaspdimportnumpyasnpimportasalixasax# Extract the dataset from a Pandas Dataframe that contains normal and not normal datadataset=ax.extract_dataset(pd.DataFrame({"normal_dataset":np.random.normal(10,2,1000),"not_normal_dataset":list(range(0,1000))}),data_column_name="normal_dataset")# Print the quartile values of the dataset on screenquartiles=ax.create_quartiles(dataset,plot=True,fig_number=1)print("\nQuartiles")print("Minimum: ",quartiles.minimum)print("1st:     ",quartiles.first)print("Median:  ",quartiles.median)print("3rd:     ",quartiles.third)print("Maximum: ",quartiles.maximum)2.6 Calculate confidence intervalimportpandasaspdimportnumpyasnpimportasalixasax# Extract the dataset from a Pandas Dataframe that contains normal and not normal datadataset=ax.extract_dataset(pd.DataFrame({"normal_dataset":np.random.normal(100,20,20),"not_normal_dataset":list(range(1,21))}),data_column_name="normal_dataset")# Print the confidence interval on screenprint("\n95% confidence internval")print("\u03C3known:  ",ax.calculate_confidence_interval(dataset,0.95,population=True))print("\u03C3unknown:",ax.calculate_confidence_interval(dataset,0.95,population=False))2.7 Check dataset usingNelson rulesimportpandasaspdimportnumpyasnpimportasalixasax# Extract the dataset from a Pandas Dataframe that contains normal and not normal datadataset=ax.extract_dataset(pd.DataFrame({"normal_dataset":np.random.normal(100,20,150),"not_normal_dataset":list(range(1,151))}),data_column_name="normal_dataset")# Print the confidence interval on screennelson_rules=ax.check_dataset_using_nelson_rules(dataset)print("\nNelson rules")print("Rule 1: ",nelson_rules.rule1)print("Rule 2: ",nelson_rules.rule2)print("Rule 3: ",nelson_rules.rule3)print("Rule 4: ",nelson_rules.rule4)print("Rule 5: ",nelson_rules.rule5)print("Rule 6: ",nelson_rules.rule6)print("Rule 7: ",nelson_rules.rule7)2.8 Plot control chartsimportpandasaspdimportnumpyasnpimportasalixasax# Extract the dataset with time dependent data from a Pandas Dataframenumber_of_points=150number_of_timestamp=10data_matrix=np.random.rand(number_of_timestamp,number_of_points)time_matrix=np.ones_like(data_matrix)foriinrange(0,number_of_timestamp):time_matrix[i,:]=time_matrix[i,:]*(i+1)time_dependent_dataset=ax.extract_time_dependent_dataset(pd.DataFrame({"time":time_matrix.ravel(),"data":data_matrix.ravel()}),"data","time")# Create the control charts and plot itxbar_chart_limit,range_chart_limit=ax.create_control_charts(time_dependent_dataset,'XbarR',plot=True)# Print on screen the contro limitsprint("\nXbar chart")print("LCL:  ",xbar_chart_limit.lcl)print("UCL:  ",xbar_chart_limit.ucl)print("CL:   ",xbar_chart_limit.cl)print("\nRange chart")print("LCL:  ",range_chart_limit.lcl)print("UCL:  ",range_chart_limit.ucl)print("CL:   ",range_chart_limit.cl)3. For developersTo upload a new version ofASALIXonPyPi:pipinstall--upgrade.
pythonexample.py
pythonsetup.pycheck
pythonsetup.pysdist
twineuploaddist/*