Module functions.matrixmixer.main
Classes
class MatrixMixer (meta_table: MetaTable2, breaks: list = [['tz']], language: str = 'de', weight: str = 'tz', special_variables_last: bool = True, study_title: Optional[str] = 'Studie', significance_level: float = 0.05, use_conf_interval: bool = False, conf_interval: float = 0.95, column_width: int = 15, column_width_b: int = 65, hide_total_break: bool = False)-
Assembles multiple tables with descriptive statistics and exports them to excel.
Args
meta_table:MetaTable2- MetaTable created using gfs_functions
breaks:list[str]- Selects the breaks used by default. Defaults to ['tz'].
language:str- Selects the language of the Matrix. Defaults to 'de'.
weight:str- Turns weight on if weight variable name is added. "gewicht", defaults to 'tz'
special_variables_last:bool- If True, special variables will be shown at the bottom. Defaults to True.
study_title:str- Title of the study. Defaults to 'Studie'.
use_conf_interval:bool- Show confidence intervals. Defaults to False.
conf_interval:float- change niveau of confidence interval. Defaults to .95.
column_width:int- Column width in Excel. Defaults to 15.
hide_total_break:bool- hides the "C" column, which is normally the "Total" break. Defaults to False.
Method generated by attrs for class MatrixMixer.
Class variables
var breaks : listvar column_width : intvar column_width_b : intvar conf_interval : floatvar hide_total_break : boolvar language : strvar meta_table : MetaTable2var significance_level : floatvar special_variables_last : boolvar study_title : Optional[str]var use_conf_interval : boolvar weight : str
Methods
def add_title_page_info(self, study_title: Optional[str] = None, clients: Optional[None] = None, survey_methodology: Optional[str] = None, sampling: Optional[str] = None, quota_features: Optional[str] = None, address_origin: Optional[None] = None, population: Optional[str] = None, weighting: Optional[str] = None, survey_period: Optional[str] = None, random_sample: Optional[str] = "Stichprobe:', f'n = {len(self.meta_table.df)}", custom_title_1: str = None, custom_description_1: str = None, custom_title_2: str = None, custom_description_2: str = None, custom_title_3: str = None, custom_description_3: str = None, custom_title_4: str = None, custom_description_4: str = None, custom_title_5: str = None, custom_description_5: str = None, custom_title_6: str = None, custom_description_6: str = None, custom_title_7: str = None, custom_description_7: str = None, custom_title_8: str = None, custom_description_8: str = None, custom_title_9: str = None, custom_description_9: str = None, show_institut: bool = True)-
sets title page info
Args
study_title:str- title of study
clients:list[str]- list of clients
survey_methodology:str- method used in study
sampling:str- sampling teqnique used
quota_features:str- feautures to quota was set on
address_origin:list[str]- origin of adresses
population:str- population of study
weighting:str- weighting variables or factors
survey_period:str- period in which the survey took place
random_sample:str- used to overwrite the random sample string, default is n = (number of recipients)
custom_title_1:str- use to set a custom title (you can set up to 9 custom_title_X)
custom_description_1:str- use to set a custom description (you can set up to 9 custom_description_X)
def create_matrix(self, question: str, breaks: list[list[str]] = 'auto', weight: str = 'auto', order_descending: Union[str, bool] = 'auto', special_variables: Union[str, list[int]] = 'auto', nps: bool = False, quartiles: bool = False, groupings: dict = None) ‑> None-
Creates a single matrix and saves it to the MatrixMixer object.
Args
question:str- Name of question. Can either be of type Column or Group.
breaks:list[list[str]], optional- Selects the breaks used in matrix. Defaults to 'auto'.
weight:str, optional- Selects the weight used in matrix. Defaults to 'auto'.
order_descending:Union[str, bool], optional- Orders the values descending or not. Use either False or True. Defaults to 'auto'.
special_variables:Union[str, list[int]], optional- List of special variables which will appear at the bottom. Could be something like [96, 97, 98, 99999997, 99999998]. Defaults to 'auto'.
nps:bool, optional- add nps to the matrix. Defaults to False.
groupings:dict, optional- groupings dictionary to create variables boxes. an example is {"Top-Box (ja, eher ja)":[1, 2]}. Defaults to None.
custom_title_1- Choose a custom title
def export_excel(self, show_title_page: bool = True, show_combined_sheet: bool = True, show_percentage_sheet: bool = True, show_absolute_sheet: bool = False, show_debugging_sheet: bool = False, table_name: str = None) ‑> None-
Exports the matrices from the MatrixMixer to Excel.
Args
show_title_page:bool, optional- show a title page. Defaults to True.
show_combined_sheet:bool, optional- shows sheet with combined values. Defaults to True.
show_percentage_sheet:bool, optional- shows sheet with percentage values. Defaults to True.
show_absolute_sheet:bool, optional- shows sheet with absolute values. Defaults to False.
show_debugging_sheet:bool, optional- shows all sheets for debugging purposes. Defaults to False.
table_name:str, optional- Name of the exported table file. Defaults to None.