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

Adjust 1 test for pyam-iamc ≥ 3 #155

Merged
merged 1 commit into from
Dec 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions genno/tests/compat/test_pyam.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import re
from collections import namedtuple
from functools import partial
from importlib.metadata import version
from typing import TYPE_CHECKING

import pandas as pd
Expand Down Expand Up @@ -179,6 +180,11 @@ def add_tm(df, name="Activity"):
idf2 = c.get(key2)
df2 = idf2.as_pandas()

# Adjust changes in behaviour in pyam-iamc ≥ 3 (Python ≥ 3.10) and < 3 (Python 3.9)
if version("pyam-iamc") >= "3.0.0":
# Version of pyam-iamc that does not sort 'region' and 'variable' dimensions
df2 = df2.sort_values(["region", "variable"], ignore_index=True)

# Extra columns have been removed:
# - m and t by the collapse callback.
# - h automatically, because 'ya' was used for the year index.
Expand Down
Loading