INNER CODE UNIT · Python
_convert_names
briscverse/ryp · ryp.py:837
def _convert_names(names: Any, names_type: Literal['rownames', 'colnames'],
python_object: Any, python_object_name: str,
rmemory: _RMemory) -> _cffi_backend._CDataBase:
"""
Convert rownames or colnames to R, raising an error if they are invalid.
Args:
names: a container (list, tuple, array, or Series) of Python strings
that will be converted to R and used as the rownames or colnames
names_type: whether names are rownames or colnames
python_object: the python object that the names are with respect to
python_object_name: the name of python_object
rmemory: an instance of the _RMemory class
Returns:
The converted rownames or colnames.
"""
if not hasattr(names, '__len__') or not hasattr(names, '__getitem__') or \