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

Pandas deprecation warnings #37

Open
knoxsp opened this issue Jun 12, 2024 · 2 comments
Open

Pandas deprecation warnings #37

knoxsp opened this issue Jun 12, 2024 · 2 comments
Assignees

Comments

@knoxsp
Copy link
Collaborator

knoxsp commented Jun 12, 2024

THe error below has started to appear:

/usr/local/lib/python3.10/dist-packages/hydra_pywr-0.1-py3.10.egg/hydra_pywr/hydra_pywr_custom_module.py:61: FutureWarning: Resampling with a PeriodIndex is deprecated. Cast index to DatetimeIndex before resampling instead.
DataFrame = pd.DataFrame(np.array(self._data), index=index, columns=sc_index).resample('M').max()
@pmslavin pmslavin self-assigned this Jun 12, 2024
@pmslavin
Copy link
Collaborator

I'll follow its advice of casting to DatetimeIndex as the proper solution; in the meantime, this can be suppressed with...

warnings.filterwarnings("ignore", category=FutureWarning, message=r".*Resampling with a PeriodIndex.*")  

...which also works when the warning is emitted by Pywr (from dataframe_tools.py:127).

@pmslavin
Copy link
Collaborator

The warning in the example above originates from the hydra_pywr_custom_module that is written by the user-defined rules processing routine in exporter.py:208 - i.e. it is a rule added by a user to a particular network and not part of hydra-pywr. There don't seem to be any instances of pd.DataFrame.resample() being used in hydra-pywr proper.

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