-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Aggregate fails with time column #222
Comments
@gidden @danielhuppmann I'm happy to write an implementation once we know which solution (of the above or something different again) fits best with other developments. |
Hi @znicholls, I am personally ok with option 2, especially with some simple helper function to switch the time column back to integer. We could further make this a configurable option in the plotting config files (how to show the time domain in plots) to completely recover existing behavior. I agree that barring that, option 1 is also fine. @danielhuppmann thoughts? |
I'm hesitant of option 2 because I fear a rabbit hole of unforeseen additional tweaks required to make the current use cases fully operational. Re the static index lists, I wouldn't just migrate all of them, but review first whether they are really necessary. They were added haphazardly during the hot development phase and some of the could probably be refactored or merged away. Re replacing |
Ok shall I have a go at doing option 1 then and clean out these static index lists as much I can?
In all tests or just this one test? |
Thanks @znicholls for volunteering - but let's tackle this one step at a time. First see if you can remove the bifurcation between |
What does this mean? Do you mean replace |
Apologies, I was mixing up options 1 and 2 (thinking you wanted to have a go at refactoring to use Please go ahead and clean up the index lists and switch tests from |
got it cheers |
Describe the bug
If you make a dataframe with datetime times and call its
aggregate
method, you receive an error. This should work the same as a dataframe with year columns.Failing Test
Change
meta_df
totest_df
in all tests intests/test_feature_aggregate.py
.System (please complete the following information):
Additional context
The failure occurs because the definition of
GROUP_IDX
is static. Hence line 1319 ofpyam/core.py
looks for ayear
column and doesn't find it, hence the failure. I think there are two possible solutions here:LONG_IDX
, moveGROUP_IDX
to being an attribute ofIamDataFrame
. It would make sense to also moveYEAR_IDX
,REGION_IDX
andSORT_IDX
at the same time in order to avoid these failures in other places. (I would suggest moving all indexes to being attributes ofIamDataFrame
for consistency.)year
support and always usetime
columns. Given earlier discussions I think this one is unlikely to happen, but this instance is another place where it would be a sensible solution. Just for completeness, I think droppingyear
support has a couple of extra arguments in its favour. It's always possible to recover year information from a datetime. It would make the meaning of thetime
column uniform (always being a datetime) and hence force users with othertime
information to put it in more well named columns (e.g.Summer evening
might have to go in aseason-time-of-day
column instead to be more explicit, it would be annoying to try and filter e.g.time
based on year only to have it explode becausetime
is full of strings).The text was updated successfully, but these errors were encountered: