biogeme.database.mdcev module¶
MDCEV Utilities
This module provides helper functions for preparing and transforming data specifically for MDCEV (Multiple Discrete Continuous Extreme Value) models.
Michel Bierlaire Wed Mar 26 19:43:21 2025
- biogeme.database.mdcev.mdcev_count(df, list_of_columns, new_column)[source]¶
Computes the number of non-zero entries across specified columns, corresponding to the number of goods consumed in MDCEV.
- Parameters:
df (
DataFrame
) – DataFrame containing the MDCEV data.list_of_columns (
list
[str
]) – Columns representing quantities of each good.new_column (
str
) – Name of the output column to store the count.
- Return type:
DataFrame
- Returns:
Modified DataFrame with the count column added.
- biogeme.database.mdcev.mdcev_row_split(df, a_range=None)[source]¶
Splits a DataFrame into a list of Database objects, one for each row, useful for row-level MDCEV processing.
- Parameters:
df (
DataFrame
) – DataFrame to split.a_range (
Optional
[Iterable
[int
]]) – Optional subset of row indices to extract.
- Return type:
list
[Database
]- Returns:
List of Database objects.