skfolio.utils.tools.validate_input_list#
- skfolio.utils.tools.validate_input_list(items, n_assets, assets_names, name, raise_if_string_missing=True)[source]#
Convert a list of items (asset indices or asset names) into a list of validated asset indices.
- Parameters:
- itemslist[int | str]
List of asset indices or asset names.
- n_assetsint
Expected number of assets. Used for verification.
- assets_namesndarray, optional
Asset names used when
itemscontain strings.- namestr
Name of the items used for error messages.
- raise_if_string_missingbool, default=True
If set to True, raises an error if an item string is missing from assets_names; otherwise, issue a User Warning.
- Returns:
- valueslist[int]
Converted and validated list.