Skip to content

Commit

Permalink
Restrict warning about engine_kwargs and pandas<2.2
Browse files Browse the repository at this point in the history
Only warn about `engine_kwargs` parameter not being fully supported at pandas < 2.2.0 for users who both have a lower pandas versions *and* actually attempt to use the engine_kwargs keyword.

Co-authored-by: Daniel Huppmann <[email protected]>
  • Loading branch information
korsbakken and danielhuppmann authored Aug 28, 2024
1 parent 95533ff commit 6a300c2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pyam/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,10 @@ def get_excel_file_with_kwargs(path, **kwargs):
excel_file_kwargs = {
k: kwargs.pop(k) for k in EXCEL_FILE_KWS if k in kwargs
}
if packaging.version.parse(importlib.metadata.version("pandas")) \
< packaging.version.parse("2.2.0"):
# TODO remove when bumping minimum pandas dependency to >= 2.2
if "engine_kwargs" in excel_file_kwargs and packaging.version.parse(
importlib.metadata.version("pandas")
) < packaging.version.parse("2.2.0"):
warnings.warn(

Check warning on line 117 in pyam/utils.py

View check run for this annotation

Codecov / codecov/patch

pyam/utils.py#L117

Added line #L117 was not covered by tests
"pandas < 2.2.0 has inconsistent support for `engine_kwargs`. "
"Using it is likely to result in an exception."
Expand Down

0 comments on commit 6a300c2

Please sign in to comment.