to_xlsx#

pycafee.normalitycheck.lilliefors.Lilliefors.to_xlsx(self, file_name=None, sheet_names=None)#

This method exports the data to excel type files.

This function is just a wraper around pd.DataFrame.to_excel [1] to export .xlsx files.

Parameters
file_namestr, optional

The name of the file to be exported, without its extension (default is None which results in a file name 'lilliefors.xlsx').

sheet_nameslist of two str, optional

A list containing the name of the worksheets where the data will be saved:

  • The first element corresponds to the name of the worksheet where the calculated data will be saved (default is None which means 'lilliefors').

  • The second element corresponds to the name of the worksheet where the supplied data will be saved (default is None which means 'data').

Returns
df_listA list of two pandas DataFrame

The first element is a pd.DataFrame with the Lilliefors calculated data. The second element is a pd.DataFrame with the supplied data.

See also

fit

performs the Lilliefors Normality test.

Notes

The fit() method needs to be applied beforehand.

If a spreadsheet with the same name already exists in the current directory and this files contains tabs with conflicting names, the new tabs will be inserted into the file with different names, preserving the original data.

References

1

pandas. pandas.DataFrame.to_excel function. Available at: pd.to_excel. Accessed on: 10 May 2022.

Examples

Export with default settings

>>> from pycafee.normalitycheck import Lilliefors
>>> import numpy as np
>>> x = np.array([1.90642, 2.22488, 2.10288, 1.69742, 1.52229, 3.15435, 2.61826, 1.98492, 1.42738, 1.99568])
>>> lilliefors_test = Lilliefors()
>>> lilliefors_test.fit(x)
>>> lilliefors_test.to_xlsx()
    The data has been exported to the 'lilliefors.xlsx' file

Download the exported file by clicking here.

Export with personalized file name

>>> from pycafee.normalitycheck import Lilliefors
>>> import numpy as np
>>> x = np.array([1.90642, 2.22488, 2.10288, 1.69742, 1.52229, 3.15435, 2.61826, 1.98492, 1.42738, 1.99568])
>>> lilliefors_test = Lilliefors()
>>> lilliefors_test.fit(x)
>>> lilliefors_test.to_xlsx(file_name="my_data")
    The data has been exported to the 'my_data.xlsx' file

Download the exported file by clicking here.

Export with personalized sheet name

>>> from pycafee.normalitycheck import Lilliefors
>>> import numpy as np
>>> x = np.array([1.90642, 2.22488, 2.10288, 1.69742, 1.52229, 3.15435, 2.61826, 1.98492, 1.42738, 1.99568])
>>> lilliefors_test = Lilliefors()
>>> lilliefors_test.fit(x)
>>> lilliefors_test.to_xlsx(file_name="lilliefors_test", sheet_names=["sample", "data"])
    The data has been exported to the 'lilliefors_test.xlsx' file

Download the exported file by clicking here.