datarobotx.common.utils.datarobot_list_encode(cols_to_select, allowed_characters='^[a-zA-Z0-9_]+$')#

Validates a list of column names based on allowed characters and returns them in a formatted hexadecimal string.

This can be used for advanced tuning or custom blueprints with tasks that take lists of strings as a tuning parameter. DR requires strings to be hex encoded when they are used in a list tuning parameter.

  • cols_to_select (List[str]) – A list of column name strings to validate and format. The length of the list should be less than 1,000.

  • allowed_characters (str, optional) – A regex pattern that specifies the allowed characters for the column names. Default is ^[a-zA-Z0-9_]+$ (alphanumeric and underscores).


A string in DataRobot Hexadecimal-encoded comma-separated list format.

Return type:



ValueError – If input is not a list or if its length is 0 or greater than 1,000. If any item in the list is not a string or is an empty string. If any strings in the list are not unique. If any string in the list does not match the allowed_characters pattern.


>>> datarobot_list_encode(["number_diagnoses", "number_inpatient"])