lace.Codebook.set_row_names
- Codebook.set_row_names(row_names: List[str] | Series | Series | ndarray)
Return a copy of the codebook with new row_names.
Examples
>>> from lace.examples import Animals >>> codebook = Animals().codebook >>> codebook.row_names[:2] ['antelope', 'grizzly+bear'] >>> codebook.set_row_names(["A", "B"]).row_names ['A', 'B']
>>> import pandas as pd >>> new_rows = pd.Series(["one", "two", "three"]) >>> codebook.set_row_names(new_rows).row_names ['one', 'two', 'three']
>>> import polars as pl >>> new_rows = pl.Series("rows", ["one-1", "two-2", "three-3"]) >>> codebook.set_row_names(new_rows).row_names ['one-1', 'two-2', 'three-3']
>>> import numpy as np >>> new_rows = np.array(["one", "two", "three-hahaha"]) >>> codebook.set_row_names(new_rows).row_names ['one', 'two', 'three-hahaha']