def to_device(strs): """ Create a nvcategory object from a list of Python strings. Parameters ---------- strs: list List of Python strings. Examples -------- .. code-block:: python import nvcategory c = nvcategory.to_device(['apple','pear','banana','orange','pear']) print(c.keys(),c.values()) Output: .. code-block:: python ['apple', 'banana', 'orange', 'pear'] [0, 3, 1, 2, 3] """ rtn = pyniNVCategory.n_createCategoryFromHostStrings(strs) if rtn is not None: rtn = nvcategory(rtn) return rtn
def to_device(strs): """Create a nvcategory object from a list of strings.""" cptr = pyniNVCategory.n_createCategoryFromHostStrings(strs) return nvcategory(cptr)