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

Compatibility issues with panda 2.0 #87

Open
LotharBrixius opened this issue Sep 18, 2023 · 2 comments
Open

Compatibility issues with panda 2.0 #87

LotharBrixius opened this issue Sep 18, 2023 · 2 comments

Comments

@LotharBrixius
Copy link

Hey,

First of all thanks for all the effort! However I found a piece of code that needs to be updated, see the following StackOverflow entry:
https://stackoverflow.com/questions/75956209/error-dataframe-object-has-no-attribute-append

File ~\anaconda3\lib\site-packages\spyder_kernels\py3compat.py:356 in compat_exec
exec(code, globals, locals)

File c:\users\lothar\documents\github\elecsim\tst.py:1
from elecsim.model.world import World

File ~\Documents\GitHub\elecsim\elecsim_init_.py:1
from elecsim.model.world import World

File ~\Documents\GitHub\elecsim\elecsim\model\world.py:15
from elecsim.plants.fuel.capacity_factor.capacity_factor_calculations import (

File ~\Documents\GitHub\elecsim\elecsim\plants\fuel\capacity_factor\capacity_factor_calculations.py:9
import elecsim.scenario.scenario_data

File ~\Documents\GitHub\elecsim\elecsim\scenario\scenario_data.py:143
carbon_price_all_years = concatenate_carbon_price()

File ~\Documents\GitHub\elecsim\elecsim\scenario\scenario_data.py:138 in concatenate_carbon_price
carbon_cost = historical_carbon_price.append(carbon_price_scenario_df, sort=True)

File ~\anaconda3\lib\site-packages\pandas\core\generic.py:5989 in getattr
return object.getattribute(self, name)

AttributeError: 'DataFrame' object has no attribute 'append'

@alexanderkell
Copy link
Owner

Hi @LotharBrixius,

Thanks for your message. Unfortunately, I no longer have time to maintain this project. I recommend trying to downgrade your pandas version to a version before 2.0. Otherwise you are more than welcome to try and fix it and open a PR!

Best wishes,
Alex

@LotharBrixius
Copy link
Author

So this should be the appropriate fix: in scenario_data.py replace the following line (138) from the definition of concatenate_carbon_price():

OUTDATED Panda: carbon_cost = historical_carbon_price.append(carbon_price_scenario_df, sort=True)

Panda 2.1.: carbon_cost = pd.concat([historical_carbon_price,carbon_price_scenario_df], ignore_index=True)

I have not done any thorough testing yet however.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants