biogeme.mdcev.database_utils module

Implementation of useful database manipulations for the MDCEV model.

Michel Bierlaire Fri Jul 25 2025, 16:45:19

biogeme.mdcev.database_utils.mdcev_count(database, list_of_columns, new_column)[source]
For the MDCEV models, we calculate the number of

alternatives that are chosen, that is the number of columns with a non zero entry, and add this as a new column

Parameters:
  • database (Database) – database to modify

  • list_of_columns (list[str]) – list of columns containing the quantity of each good.

  • new_column (str) – name of the new column where the result is stored

Return type:

None

biogeme.mdcev.database_utils.mdcev_row_split(database, a_range=None)[source]

For the MDCEV model, we generate a list of Database objects, each of them associated with a different row of the database,

Parameters:
  • database (Database) – input database.

  • a_range (Iterable[int] | None) – specify the desired range of rows.

Return type:

list[Database]

Returns:

list of rows, each in a Database format