Module functions.metatables.column
Classes
class Column (name: str, label: str, value_labels: dict[int, str], item_value_labels: dict[int, str], spss_type: str, readstat_type: str, display_width: int, storage_width: int, measure: str, missing_values: list, kind: str, group: str = None, lfm: Optional[str] = None, mean: Optional[str] = None, group_value_labels: dict[int, str] = _Nothing.NOTHING, group_label: Optional[str] = None, item_label: Optional[str] = None, filter_label: Optional[str] = '')
-
Represents a column in a dataset with metadata information.
This class is designed to store various properties of a dataset column, such as name, label, data types, display and storage properties, etc.
Attributes
name
:str
- The name of the column.
label
:str
- The label for the column.
value_labels
:dict[int, str]
- Mapping of numerical values to their labels.
item_value_labels
:dict[int, str]
- Mapping of item values to their labels.
spss_type
:str
- SPSS data type for the column.
readstat_type
:str
- ReadStat data type for the column.
display_width
:int
- Width of the column for display purposes.
storage_width
:int
- Width of the column for storage purposes.
measure
:str
- Measurement type of the column ('string', 'nominal', 'scale', 'ordinal').
missing_values
:list
- List of missing values for the column.
kind
:str
- Kind of the column ('single', 'batch', 'multi').
group
:str
, optional- Group information for the column.
lfm
:str
, optional- Response format for missing data ('yes', 'no', '').
mean
:str
, optional- Indicates whether mean is applicable ('yes', 'no', '').
group_value_labels
:dict[int, str]
, optional- Value labels for groups.
group_label
:str
, optional- Label for the group.
item_label
:str
, optional- Label for the item.
filter_label
:str
, optional- Label for filtering.
Example
column = Column( name='column_name', label='Column Label', value_labels={1: 'Label 1', 2: 'Label 2'}, item_value_labels={1: 'Item Label 1', 2: 'Item Label 2'}, spss_type='SPSS_TYPE', readstat_type='READSTAT_TYPE', display_width=10, storage_width=8, measure='scale', missing_values=[-99], kind='single', group='Group 1', lfm='yes', mean='no', group_value_labels={1: 'Group Label 1', 2: 'Group Label 2'}, group_label='Group Label', item_label='Item Label', filter_label='Filter Label' )
Method generated by attrs for class Column.
Class variables
var display_width : int
var filter_label : Optional[str]
var group : str
var group_label : Optional[str]
var group_value_labels : dict[int, str]
var item_label : Optional[str]
var item_value_labels : dict[int, str]
var kind : str
var label : str
var lfm : Optional[str]
var mean : Optional[str]
var measure : str
var missing_values : list
var name : str
var readstat_type : str
var spss_type : str
var storage_width : int
var value_labels : dict[int, str]
class ColumnDict (*args, **kwargs)
-
A custom dictionary for storing Column objects with string keys.
This class is designed to be used within a MetaTable to store information about different columns in a dataset.
Attributes
Inherits from dict.
Methods
setitem(key, value): Overrides the setitem method to enforce that keys must be strings and values must be instances of the Column class.
Example
column_dict = ColumnDict() column_dict['column_name'] = Column(…)
Ancestors
- builtins.dict