HiSim icon indicating copy to clipboard operation
HiSim copied to clipboard

FutureWarning: treating keys as positions is deprecated

Open k-knosala opened this issue 1 year ago • 0 comments

When running household_with_advanced_hp_hws_hds_pv I get the following Warning:

hisim/components/weather.py:824: FutureWarning: Series.getitem treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use ser.iloc[pos] pd_database[-1],

In weather.py

        lastday = pd.Series(
            pd_database[-1],
            index=[
                pd.to_datetime(
                    datetime.datetime(year, 12, 31, 22, 59), utc=True
                ).tz_convert(tz="Europe/Berlin")
            ],
        )

should be changed to

        lastday = pd.Series(
            pd_database.iloc[-1],
            index=[
                pd.to_datetime(
                    datetime.datetime(year, 12, 31, 22, 59), utc=True
                ).tz_convert(tz="Europe/Berlin")
            ],
        )

k-knosala avatar Oct 11 '23 09:10 k-knosala