About cookies on this site Our websites require some cookies to function properly (required). In addition, other cookies may be used with your consent to analyze site usage, improve the user experience and for advertising. For more information, please review your options. By visiting our website, you agree to our processing of information as described in IBM’sprivacy statement. To provide a smooth navigation, your cookie preferences will be shared across the IBM web domains listed here.
Last updated: Feb 11, 2025
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
Represents a field in a
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)
You can use the metadata dictionary instance to store the measure, role, or label attribute for
the specific field. The key words for these attributes are:
: the key word formeasure
attributemeasure
: the key word forrole
attributerole
: the key word fordisplayLabel
attributelabel
Example:
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)
Was the topic helpful?
0/1000