The output, if transformation is successful, will always be an ordinal (ordered 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

In both cases, the specified categories have to match the ones already existing. I.e. only re-ordering is allowed, but not deletion or addition of new categories.

If the column is not already a category:

  • the column will be converted if the param force_categorical is true, and ordered as desired. Otherwise the new column will be identical to the input (no ordering performed).
categories
[array[['string', 'number']], null]

List with desired order of categories. If null, the unique and lexicographically sorted existing values in the input column will be used.

force_categorical
boolean
default: "true"

Whether to convert non-categorical input columns to category before ordering (otherwise will be unchanged).