Skip to content
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

Allow filtering by list of values and wildcard #417

Open
danielhuppmann opened this issue Oct 16, 2024 · 2 comments
Open

Allow filtering by list of values and wildcard #417

danielhuppmann opened this issue Oct 16, 2024 · 2 comments
Assignees

Comments

@danielhuppmann
Copy link
Member

The current implementation of CodeList.filter() allows to select by a tag-value combination - however, it is not possible to select by a list, and it is not possible to do wildcard-matching (like pyam).

For example, it would be useful to support the following

RegionCodeList.filter(hierarchy=["R5", "R9"])
VariableCodeList.filter(variable="Final Energy|*")
@danielhuppmann
Copy link
Member Author

I guess that there are synergies in implementation with #416

@phackstock
Copy link
Contributor

it is not possible to select by a list

To be precise, it is possible to select by a list, it is just currently applied literally, so your example for hierarchy would match if for all regions with hierarchy=["R5", "R9"].
So what we'd need to change the logic around and treat a list input as "match true if any of the values" match.

This would leave the question though what we would do if we actually wanted to literally filter for a list match. Maybe an additional keyword ...? Or we just don't offer this functionality.

I'd also suggest doing this in two PRs (one for lists, one for the wildcard) for a cleaner separation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants