IAMconsortium / pyam

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

Lots of pandas warnings when using conn.query() #645

Closed nezzag closed 2 years ago

nezzag commented 2 years ago

Hi there, I am using conn.query() to access data from IIASA. However, I am currently getting a large number of warnings from the iiasa.py script. All the warnings are the same and read: FutureWarning: The default dtype for empty Series will be 'object' instead of 'float64' in a future version. Specify a dtype explicitly to silence this warning. pd.concat([row[META_IDX + cols], pd.Series(row.metadata)])

This is coming from where iiasa.py is trying to return meta data on the scenarios.

I'm running with pyam 1.3.1, and my example code looks like:

import pyam
conn = pyam.iiasa.Connection("engage")
data = conn.query(
    region="World",
    variable=[
        "Secondary Energy|Electricity*",
        "Primary Energy|*",
        "Final Energ*",
        "Carbon Sequestration*",
        "Emissions|CO2|AFOLU",
        "Emissions|CO2",
    ]
)

The code still runs and appears to access the IamDataFrame fine, but I was wondering if anyone knows why these errors might be appearing? I've been using conn.query() previously without any issue, but can't think of any changes to my packages/set-up that might be leading to this.

Thanks in advance, Neil

danielhuppmann commented 2 years ago

Thanks @nezzag for reporting this issue! The warnings are due to some recent updates in pandes.

The problem was actually already solved on the pyam-side by @coroa in #636, but we did not have a new release since the changes were merged. You can either install the latest directly from GitHub, or you wait a few weeks until we have a new release.

Please reopen the issue if the problem cannot be resolved by either of the two options specified above.