category
) column,
even if the input was an unordered category
or not a Category
at all. I.e. it is supposed
that re-ordering the categories means the order is important.
If the input column is already a category
:
- If unordered (non-ordinal): categories will be ordered in the given order (converted to ordinal)
- If ordered (ordinal): categories will be re-ordered only
category
:
- the column will be converted if the param
force_categorical
istrue
, and ordered as desired. Otherwise the new column will be identical to the input (no ordering performed).
Usage
The following examples show how the step can be used in a recipe.Examples
Examples
To arrange the categories “small”, “medium”, “large” (“S”, “M”, “L”) in reverser order:
Inputs & Outputs
The following are the inputs expected by the step and the outputs it produces. These are generally columns (ds.first_name
), datasets (ds
or ds[["first_name", "last_name"]]
) or models (referenced
by name e.g. "churn-clf"
).
Inputs
Inputs
A column to re-order or convert to ordinal (ordered
category
).Outputs
Outputs
An ordinal column.
Configuration
The following parameters can be used to configure the behaviour of the step by including them in a json object as the last “input” to the step, i.e.step(..., {"param": "value", ...}) -> (output)
.
Parameters
Parameters
List with desired order of categories.
If
null
, the unique and lexicographically sorted existing values in the input column will be used.Array items
Array items
Each item in array.
Whether to convert non-categorical input columns to
category
before ordering (otherwise will be unchanged).