urbansim icon indicating copy to clipboard operation
urbansim copied to clipboard

Transition model, preserve index name?

Open bridwell opened this issue 5 years ago • 2 comments

When running transition model, the resulting data frame loses the index name (I'm guessing because of the concat). Is this worth preserving? This would be a simple fix, but not sure if it would break existing implementations.

bridwell avatar Jan 23 '20 17:01 bridwell

We came across this too. Our transition model handles it by running these lines after the full_transition() (for HTM):

orca.get_table("persons").index.name = persons.index.name
orca.get_table("households").index.name = households.index.name

But this should be handled by the urbansim_defaults.utils.full_transition() function.

hanase avatar Jan 27 '20 19:01 hanase

Hi @bridwell, thanks for pointing this out. I agree that it should be fixed. It seems unlikely to break anything (and worth doing even if it did).

Is the concat you're referring to the one in transition.py#L468? I'm not sure exactly what's happening there, but it looks like the second DataFrame doesn't have a named index, which would as you say lead to the index name of the main table being dropped.

And probably fixing it at the source would fix urbansim_defaults too.

smmaurer avatar Jan 27 '20 22:01 smmaurer