convert_to_list
- dtaianomaly.utils.convert_to_list(value: T | list[T]) list[T][source]
Convert a given value to a list.
Convert the given value in a list. If the value already is a list, then it will simply be returned. Otherwise, a list is returned with a single element as the given element.
- Parameters:
- valuelist or other
The value to convert to a list.
- Returns:
- list
The given value in a list.
Examples
>>> from dtaianomaly.utils import convert_to_list >>> convert_to_list(1) [1] >>> convert_to_list(3.14) [3.14] >>> convert_to_list([1, 3.14]) [1, 3.14]