From 0a255a4de2be661ec84bf6110fdd2f455e4167e9 Mon Sep 17 00:00:00 2001 From: michaelavs Date: Wed, 23 Nov 2022 09:58:40 -0700 Subject: [PATCH 1/3] Targets env updates, Pandas warnings --- dgen_os/python/dg3n.yml | 6 +++--- dgen_os/python/dgen_model.py | 7 +++++++ dgen_os/python/input_data_functions.py | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/dgen_os/python/dg3n.yml b/dgen_os/python/dg3n.yml index 7d6ffc8..b10df17 100644 --- a/dgen_os/python/dg3n.yml +++ b/dgen_os/python/dg3n.yml @@ -5,17 +5,17 @@ channels: - anaconda - nrel dependencies: - - python=3 + - python - colorama - colorlog - requests - matplotlib - numpy - openpyxl - - pandas=1.1.5 + - pandas - pyarrow - psutil - - psycopg2 + - psycopg2=2.8.6 - scipy - spyder - sqlalchemy diff --git a/dgen_os/python/dgen_model.py b/dgen_os/python/dgen_model.py index 5a7056a..f09f865 100644 --- a/dgen_os/python/dgen_model.py +++ b/dgen_os/python/dgen_model.py @@ -25,7 +25,14 @@ #============================================================================== pd.set_option('mode.chained_assignment', None) #============================================================================== +# Suppress warnings from Pandas +'''Should be re-visted if/when Pandas supports psycopg2 or when work can be done +to update code to use SQLalchemy instead''' +import warnings + +warnings.simplefilter("ignore") +#============================================================================== def main(mode = None, resume_year = None, endyear = None, ReEDS_inputs = None): """ diff --git a/dgen_os/python/input_data_functions.py b/dgen_os/python/input_data_functions.py index d32ac99..107786e 100644 --- a/dgen_os/python/input_data_functions.py +++ b/dgen_os/python/input_data_functions.py @@ -319,7 +319,7 @@ def deprec_schedule(df): for year in missing_years: last_entry['year'] = year - df = df.append(last_entry) + df = pd.concat([df,last_entry], ignore_index=True, sort=False) return df.loc[:,['year','sector_abbr','deprec_sch']] From e206a2faa156020b486c82c10c0c3ca66c2fbadc Mon Sep 17 00:00:00 2001 From: michaelavs Date: Tue, 29 Nov 2022 11:04:16 -0700 Subject: [PATCH 2/3] Removes Python dependency, update README to mention Python 3 --- README.md | 1 + dgen_os/python/dg3n.yml | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a5087c1..2769a3f 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,7 @@ After cloning this repository and installing (and running) Docker as well as Ana ```$ conda env create -f dg3n.yml``` - This will create the conda environment needed to run the dgen model. +- The dgen model is optimized for Python v3 and above. Run ```$ conda list ``` to verify you have this version. 2. This command will create a container with PostgreSQL initialized. diff --git a/dgen_os/python/dg3n.yml b/dgen_os/python/dg3n.yml index b10df17..98f158a 100644 --- a/dgen_os/python/dg3n.yml +++ b/dgen_os/python/dg3n.yml @@ -5,7 +5,6 @@ channels: - anaconda - nrel dependencies: - - python - colorama - colorlog - requests From a4d2f3ce554a38478bdb3697b475e63dd3b1a421 Mon Sep 17 00:00:00 2001 From: Michaela Sizemore <43652875+michaelavs@users.noreply.github.com> Date: Tue, 3 Oct 2023 10:55:32 -0600 Subject: [PATCH 3/3] Unpin psycopg2 due to issue being resolved --- dgen_os/python/dg3n.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dgen_os/python/dg3n.yml b/dgen_os/python/dg3n.yml index 98f158a..c0ab273 100644 --- a/dgen_os/python/dg3n.yml +++ b/dgen_os/python/dg3n.yml @@ -14,9 +14,9 @@ dependencies: - pandas - pyarrow - psutil - - psycopg2=2.8.6 + - psycopg2 - scipy - spyder - sqlalchemy - nrel-pysam 2.1.4 - - nrel-pysam-stubs 2.1.4 \ No newline at end of file + - nrel-pysam-stubs 2.1.4