msmu.dt.replace
Replace column values in place using pandas-style replacement mappings.
columns maps column names to {old: new} rules. Unmatched values
(including missing values unless explicitly mapped) remain unchanged.
Restricted dtypes such as nullable booleans and categories are converted
to object when needed to accommodate new values. Only rules are recorded.
Table paths follow map. Returns the same MuData.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mdata
|
MuData
|
|
required |
target
|
str
|
Table path as described by |
required |
columns
|
dict[str, dict]
|
Nonempty mapping from each column name to an |
required |
Returns:
| Type | Description |
|---|---|
MuData
|
The same |
Examples:
import msmu as mm
mm.dt.replace(mdata, target="protein.obs", columns={"condition": {"ctrl": "control"}})