Next: , Previous: , Up: categorical   [Contents]


8.2.5.2 categorical.categorical

Constructor: obj = categorical ()

Constructs a new scalar categorical whose value is undefined.

Constructor: obj = categorical (vals)
Constructor: obj = categorical (vals, valueset)
Constructor: obj = categorical (vals, valueset, category_names)
Constructor: obj = categorical (…, 'Ordinal', Ordinal)
Constructor: obj = categorical (…, 'Protected', Protected)

Constructs a new categorical array from the given values.

vals is the array of values to convert to categoricals.

valueset is the set of all values from which vals is drawn. If omitted, it defaults to the unique values in vals.

category_names is a list of category names corresponding to valueset. If omitted, it defaults to valueset, converted to strings.

Ordinal is a logical indicating whether the category values in obj have a numeric ordering relationship. Defaults to false.

Protected indicates whether obj should be protected, which prevents the addition of new categories to the array. Defaults to false.