pharmpy.modeling.set_unit#

pharmpy.modeling.set_unit(model_or_datainfo, column, unit)[source]#

Specify the unit of a column

Note that no conversion of units will happen if the unit was already set.

Parameters:
  • model_or_datainfo (Model | DataInfo) – Model object or DataInfo object

  • column (str) – Name of a column. If the column contains multiple variables, e.g. DV with multiple DVs, the ID can be specified with a colon. For example “DV:1” will mean the DV column only when DVID is 1.

  • unit (str) – The unit

Returns:

Model | DataInfo – An updated Model or DataInfo object

Example

>>> from pharmpy.modeling import load_example_model, set_unit
>>> model = load_example_model("pheno")
>>> model = set_unit(model, "WGT", "kg")

See also

convert_unit