Module functions.matrixmixer
gfs-matrixmixer
This assembles multiple tables with descriptive statistics and is part of the technology stack of gfs-zürich.
Sub-modules
functions.matrixmixer.formatting
functions.matrixmixer.helper
functions.matrixmixer.main
functions.matrixmixer.significances
Classes
class MatrixMixer (meta_table: MetaTable2, breaks: list = [['tz']], language: str = 'de', weight: str = 'tz', special_variables_last: bool = True, study_title: str = 'Studie', significance_level: float = 0.05, use_conf_interval: bool = False, conf_interval: float = 0.95, column_width: int = 15, 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 : list
var column_width : int
var conf_interval : float
var hide_total_break : bool
var language : str
var meta_table : MetaTable2
var significance_level : float
var special_variables_last : bool
var study_title : str
var use_conf_interval : bool
var weight : str
Methods
def add_title_page_info(self, study_title: str, clients: list[str], survey_methodology: str, sampling: str, quota_features: str, address_origin: list[str], population: str, weighting: str, survey_period: str, random_sample: str = None)
-
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)
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, 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.
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.