-
Notifications
You must be signed in to change notification settings - Fork 122
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
Add an index
attribute of model-scenario combinations
#438
Add an index
attribute of model-scenario combinations
#438
Conversation
This works perfectly if we have metadata - are there no circumstances under which we don't (other than calling "del df.meta")? I’m happier calling df.meta.index myself, and this has less chance of being confused with df._data.index or df.data.index (which is what I’d assume the function would return). A more descriptive name would solve this problem, but would probably take longer to type than the actual command. |
The whole point of the IamDataFrame is that you have timeseries Now that you have inspired this idea, I like it because it allows to show this simple approach for looping over all model-scenario combinations in the API docs. Users might not even think of using |
It's definitely showcasing a useful feature of the metadata and currently I do do things like Zeb suggested in my code, which makes it ugly. The confusing aspect to me is the name - I'd be much happier if it were called "metaindex" or similar. |
I try to avoid the word I see our data model going into a direction of There are a number of validation functions (require_variable, validate, check_aggregate, ...) that have an If we want to have other types of information (e.g., indicators by model/scenario/region), I see this as being implemented as a new attribute, not adding it to meta because this would break the validation feature. |
Please confirm that this PR has done the following:
Description of PR
Per suggestions by @Rlamboll and @znicholls in the discussion related to #432, this PR adds an
index
attribute, where the index dimensions are those common to both the timeseries data and meta dataframes, i.e.,model
andscenario
.This allows to easily loop over available models and scenarios, by using
This snippet is also shown in the docstring of the new function.
To make the meaning of
index
intuitive for new users of pyam, theinfo()
output is changed to the following (inspired byxarray
):