tally.dataset.DataSet.derive#

DataSet.derive(**kwargs)#

Create meta and recode case data by specifying derived category logics.

Derived variables have their answer codes derived from other variables. Derived variables can either be multi-choice (called delimited set) or single-choice.

A derived variable can be created from one variable, for example when a likert scale question has NETs added to it, or it can be created from multiple variables. When a derived variable is created from multiple variables, the user has to define how these variables should be used to create the new one with by defining whether the new variable is an intersection or a union (logical expressions and or or).

The conditional map has a list/array of of either three or four elements of following structures:

#### 3 elements, type of logic not specified: [code, label, logic dictionary], e.g.:

[1, "People who live in urban and sub-urban settings", {'locality': [1,2]}

#### 4 elements, type of logic speficied: [1, label, type of logic, logic_dictionary), e.g.:

[1, "Men in urban and suburban locations", 'intersection', {'gender': [1] 'locality': [1,2]))]

[2, "Women in urban and suburban locations", 'intersection', {'gender': [2] 'locality': [1,2]))

The logic types are ‘union’ and ‘intersection’. If no logic type is specified, ‘union’ is used. union is equivalent to the logical expression or and intersection is equivalent to and.

namestring

The column variable name.

labelstring

Name of the variable to show meta data for

qtypestring

The structural type of the data the meta describes (int, float, single or delimited set)

cond_mapsarray

List of logic dictionaries that define how each answer and code is derived.

cond_maparray (deprecated)

List of “tuples”, see documentatio above.