remove_unused_columns#

pharmpy.modeling.remove_unused_columns(model)[source]#

Remove all columns in the dataset that are not used by the model including dropped columns

Warning

Currently columns not needed to give a prediction, but used by other expressions in the model are kept. This will change in the future.

Parameters:

model (Model) – Pharmpy model

Returns:

Model – Updated Pharmpy model

Example

>>> from pharmpy.modeling import *
>>> model = load_example_model("pheno")
>>> model = remove_unused_columns(model)
>>> list(model.dataset.columns)
['ID', 'TIME', 'AMT', 'WGT', 'APGR', 'DV']

See also

drop_columns

Drop columns from the dataset