Skip to content

Full transition model looses the index name and saves orca table with more than local columns #35

@cvanoli

Description

@cvanoli

I would like to improve two things in the utils.full_transition model.

  1. It happens that the new dataframe that results from this operation:
new, added_hh_idx, new_linked = model.transition(
        hh, year, linked_tables=linked_tables)

which is then saved as the new orca table, looses the index name, for example 'household_id'
So the solution I propose is to add this line:
new.index.name = hh.index.name
right after this line, to make sure the index name gets preserved.

  1. The agents table is called with the local columns and the settings.get('add_columns', []):
    hh = agents.to_frame(agents.local_columns + settings.get('add_columns', [])).
    But then, when the new table is saved as an orca table, orca.add_table(agents.name, new), all the columns specified in the to_frame() are passed as local_columns which is a change that the model should not do. So I propose that when registering the new data frame as an orca table, we pass the local_columns as well, like this:
    orca.add_table(agents.name, new[agents.local_columns])

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions