From 9a288a97a58384ebc75772339f30d502aaa958b2 Mon Sep 17 00:00:00 2001 From: Katherine Klise Date: Sat, 18 Nov 2023 10:45:25 -0800 Subject: [PATCH] Remove deprecated pandas lookup --- chama/impact.py | 11 +++++++---- requirements.txt | 2 +- setup.py | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/chama/impact.py b/chama/impact.py index 4e99640..8072b23 100644 --- a/chama/impact.py +++ b/chama/impact.py @@ -153,10 +153,13 @@ def detection_time_to_impact(detection_time, impact_data): impact_data.interpolate(inplace=True) det_damage = detection_time.copy() - det_damage['T'] = impact_data.lookup(detection_time['T'], - detection_time['Scenario']) - det_damage.rename(columns={'T': 'Impact'}, inplace=True) - + times = detection_time['T'] + scenarios = detection_time['Scenario'] + impact_vals = impact_data.to_numpy()[impact_data.index.get_indexer(times), + impact_data.columns.get_indexer(scenarios)] + det_damage['Impact'] = impact_vals + del det_damage['T'] + return det_damage diff --git a/requirements.txt b/requirements.txt index bb75005..e4fb280 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ # Required pyomo -pandas<2.0 +pandas numpy scipy diff --git a/setup.py b/setup.py index 0833e3b..cfc1aef 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ MAINTAINER_EMAIL = 'kaklise@sandia.gov' LICENSE = 'Revised BSD' URL = 'https://github.com/sandialabs/chama' -DEPENDENCIES = ['pyomo', 'pandas<2.0', 'numpy', 'scipy'] +DEPENDENCIES = ['pyomo', 'pandas', 'numpy', 'scipy'] # use README file as the long description file_dir = os.path.abspath(os.path.dirname(__file__))