This section describes how to set up the data model attributes based on
.pyspark.sql.StructField
spss.datamodel.Role Objects
This class enumerates valid roles for each field in a data model.
: Indicates that this field can be either an antecedent or a consequent.BOTH
: Indicates that this field is to be used as a frequency weight; this
isn't displayed to the user.FREQWEIGHT
: Indicates that this field is a predictor or an antecedent.INPUT
: Indicates that this field is not used directly during modeling.NONE
: Indicates that this field is predicted or a consequent.TARGET
: Indicates that this field identifies the data partition.PARTITION
: Indicates that this field identifie the record id.RECORDID
: Indicates that this field splits the data.SPLIT
spss.datamodel.Measure Objects
This class enumerates measurement levels for fields in a data model.
: Indicates that the measure type is unknown.UNKNOWN
: Indicates that the measure type is continuous.CONTINUOUS
: Indicates that the measure type is nominal.NOMINAL
: Indicates that the field value is one of two values.FLAG
: Indicates that the field value should be interpreted as a collection
of values.DISCRETE
: Indicates that the measure type is ordinal.ORDINAL
: Indicates that the field can have any value compatible with its
storage.TYPELESS
pyspark.sql.StructField Objects
StructType
. A StructField
object
comprises four fields:
: name of aname (string)
StructField
: specific data typedataType (pyspark.sql.DataType)
: if the values of anullable (bool)
can containStructField
valuesNone
: a python dictionary that stores the option attributesmetadata (dictionary)
: the key word formeasure
attributemeasure
: the key word forrole
attributerole
: the key word fordisplayLabel
attributelabel
from spss.datamodel.Role import Role from spss.datamodel.Measure import Measure _metadata = {} _metadata['measure'] = Measure.TYPELESS _metadata['role'] = Role.NONE _metadata['displayLabel'] = "field label description" StructField("userName", StringType(), nullable=False, metadata=_metadata)