From f35a8a4514044e71e2a46b9d942dbc5b63d8a5b3 Mon Sep 17 00:00:00 2001 From: fletp Date: Wed, 24 Jul 2019 11:23:36 -0400 Subject: [PATCH 1/3] Future-proof against pandas default change Added explicit sort argument to pd.concat. Retaining current default behavior to alphanumerically sort columns of final dataframe after a row concatenation. Pandas default will change to not sorting in a future version. --- rFirm/steps/firm_synthesis.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rFirm/steps/firm_synthesis.py b/rFirm/steps/firm_synthesis.py index 3e238e8..b8252bf 100644 --- a/rFirm/steps/firm_synthesis.py +++ b/rFirm/steps/firm_synthesis.py @@ -374,7 +374,7 @@ def firm_sim_scale_employees( firms_foreign.index.name = firms.index.name # Combine the new firms with foreign firms - firms = pd.concat([firms, firms_foreign]).sort_index() + firms = pd.concat([firms, firms_foreign], sort=True).sort_index() assert firms.index.is_unique # index (bus_id) should be unique # Recode employee counts into categories From b8c6db9a3bb043e0e089ed30312427d46fec75ad Mon Sep 17 00:00:00 2001 From: fletp Date: Wed, 24 Jul 2019 11:57:30 -0400 Subject: [PATCH 2/3] Fix indentation in firm_synthesis Travis failed to build the code because of an indentation error. This has now been corrected. --- rFirm/steps/firm_synthesis.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rFirm/steps/firm_synthesis.py b/rFirm/steps/firm_synthesis.py index b8252bf..1f9efd5 100644 --- a/rFirm/steps/firm_synthesis.py +++ b/rFirm/steps/firm_synthesis.py @@ -1233,8 +1233,8 @@ def firm_synthesis( if REGRESS: regress(df=firm_io_pairs, step_name='firm_sim_iopairs', df_name='iopairs') if TRACE_TAZ is not None: - print "\nfirm_sim_iopairs TRACE_TAZ %s firm_input_output_pairs\n" % \ - TRACE_TAZ, firm_io_pairs[firm_io_pairs.TAZ == TRACE_TAZ].sort_values('bus_id') + print "\nfirm_sim_iopairs TRACE_TAZ %s firm_input_output_pairs\n" % \ + TRACE_TAZ, firm_io_pairs[firm_io_pairs.TAZ == TRACE_TAZ].sort_values('bus_id') # - firm_sim_producers t0 = print_elapsed_time() From 8d9c8f7411988b1efd8eea1a04defc70b26683f7 Mon Sep 17 00:00:00 2001 From: fletp Date: Wed, 24 Jul 2019 12:11:00 -0400 Subject: [PATCH 3/3] Specify package versions for Travis rFirm currently requires earlier pyyaml and activitysim versions in order to run. This commit specifies those package versions in .travis.yml --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7af4d30..ecc959e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,12 +13,12 @@ install: - conda update -q conda - conda info -a - | - conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION cytoolz numpy pandas pip pytables pyyaml toolz psutil + conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION cytoolz numpy pandas pip pytables pyyaml=3.13 toolz psutil - source activate test-environment - pip install orca openmatrix zbox - pip install pytest pytest-cov coveralls pycodestyle pytest-xdist - pip install sphinx numpydoc -- pip --no-cache-dir install https://github.com/ActivitySim/activitysim/zipball/master +- pip install activitysim==0.5.1 - pip install . script: - pycodestyle rFirm