transform.specimen_type(spec_type_col: str)
Specimen Type
Usage
The function can be called into a .with_columns() statement. It will reference the dataframe’s status column and output a cleaned version of it.
Parameters
spec_type_col : str
-
specimen type column
Examples
import polars as pl
import wadoh_subtyping.transform as tf
from wadoh_raccoon.utils import helpers
df = pl.DataFrame({
"SpecimenSource": [
"Resipiratory: nasal swab",
"Nasopharyngeal Swab (NP)",
"Conjunctival Swab"
]
})
# here's how to apply the function
df = (
df
.with_columns(
SPECIMEN_TYPE=tf.specimen_type(spec_type_col='SpecimenSource')
)
)
# here's a table output
helpers.gt_style(df_inp=df)
| 0 |
Resipiratory: nasal swab |
None |
| 1 |
Nasopharyngeal Swab (NP) |
Swab-nasopharyngeal (NP) |
| 2 |
Conjunctival Swab |
None |