IAMconsortium / pyam

Analysis & visualization of energy & climate scenarios
https://pyam-iamc.readthedocs.io/
Apache License 2.0
222 stars 116 forks source link

Error when year-column headers are mixed int and str #670

Open danielhuppmann opened 2 years ago

danielhuppmann commented 2 years ago

Per a bug report by @M-Neuwirth: if the years in the column headers are mixed between integer and strings in an IAMC-style xlsx file, importing as an IamDataFrame fails with the following error message:

~/GitHub/pyam/pyam/utils.py in format_data(df, index, **kwargs)
    320         if year_cols and not time_cols:
    321             time_col = "year"
--> 322             melt_cols = sorted(year_cols)
    323         else:
    324             time_col = "time"

TypeError: '<' not supported between instances of 'str' and 'int'