infer_datatypes#

pharmpy.modeling.infer_datatypes(model, columns=None)[source]#

Infer and set datatypes for the dataset

All columns or only the ones set in the columns option will be checked for conversion to a simpler datatype. Currently only int32 will be checked since this corresponds to the integer type in R.

Parameters:
  • model (Model) – Pharmpy model

  • columns (list[str]) – The columns to attempt conversion or None for all

Returns:

Model – Updated Pharmpy model

Examples

>>> from pharmpy.modeling import *
>>> model = load_example_model("pheno")
>>> model = infer_datatypes(model, ['APGR'])
>>> model.dataset
     ID   TIME   AMT  WGT  APGR    DV  FA1  FA2
0     1    0.0  25.0  1.4     7   0.0  1.0  1.0
1     1    2.0   0.0  1.4     7  17.3  0.0  0.0
2     1   12.5   3.5  1.4     7   0.0  1.0  1.0
3     1   24.5   3.5  1.4     7   0.0  1.0  1.0
4     1   37.0   3.5  1.4     7   0.0  1.0  1.0
..   ..    ...   ...  ...   ...   ...  ...  ...
739  59  108.3   3.0  1.1     6   0.0  1.0  1.0
740  59  120.5   3.0  1.1     6   0.0  1.0  1.0
741  59  132.3   3.0  1.1     6   0.0  1.0  1.0
742  59  144.8   3.0  1.1     6   0.0  1.0  1.0
743  59  146.8   0.0  1.1     6  40.2  0.0  0.0

[744 rows x 8 columns]