syntactic.make_dimnames¶
- syntactic.make_dimnames(rownames: list[str] | None = None, colnames: list[str] | None = None) dict[str, list[str] | None]¶
Apply syntactic naming to row and/or column name vectors.
Equivalent to R’s
makeDimnames: appliesmake_names()withunique=Trueto each supplied name vector.- Parameters:
- Returns:
Mapping with keys
"rownames"and"colnames", each either a sanitized list orNone.- Return type:
Examples
>>> make_dimnames(rownames=["Row 1", "Row 2"], colnames=["My Col"]) {'rownames': ['Row_1', 'Row_2'], 'colnames': ['My_Col']} >>> make_dimnames(colnames=["Bad Name!", "Good"]) {'rownames': None, 'colnames': ['Bad_Name', 'Good']}