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

[DNMY] Address pandas deprecation of date_parser for pandas.read_csv #648

Merged
merged 4 commits into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions doc/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Upcoming Release

* Renamed script file from PyPSA-EUR ``build_load_data`` to ``build_electricity_demand``.

* Addressed deprecation warnings for ``pandas=2.0``. ``pandas=2.0`` is now minimum requirement.

PyPSA-Eur 0.8.0 (18th March 2023)
=================================

Expand Down
2 changes: 1 addition & 1 deletion envs/environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ dependencies:
- lxml
- powerplantmatching>=0.5.5
- numpy<1.24
- pandas>=1.4
- pandas>=2.0
- geopandas>=0.11.0
- xarray
- rioxarray
Expand Down
5 changes: 1 addition & 4 deletions scripts/build_electricity_demand.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,8 @@ def load_timeseries(fn, years, countries, powerstatistics=True):
def rename(s):
return s[: -len(pattern)]

def date_parser(x):
return dateutil.parser.parse(x, ignoretz=True)

return (
pd.read_csv(fn, index_col=0, parse_dates=[0], date_parser=date_parser)
pd.read_csv(fn, index_col=0, parse_dates=[0], date_format="%Y-%m-%dT%H:%M:%SZ")
.filter(like=pattern)
.rename(columns=rename)
.dropna(how="all", axis=0)
Expand Down