Address pandas deprecation of date_parser for pandas.read_csv

This commit is contained in:
euronion 2023-04-22 20:33:38 +02:00
parent 2b069e3031
commit 54346b071e
3 changed files with 4 additions and 5 deletions

View File

@ -17,6 +17,8 @@ Upcoming Release
* Renamed script file from PyPSA-EUR ``build_load_data`` to ``build_electricity_demand``.
* Adressed deprecation warnings for ``pandas=2.0``. ``pandas=2.0`` is now minimum requirement.
PyPSA-Eur 0.8.0 (18th March 2023)
=================================

View File

@ -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

View File

@ -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)