From 01656154e6d97067faf247bc98283cbe40a8fbfb Mon Sep 17 00:00:00 2001 From: romainsacchi Date: Sun, 29 Sep 2024 10:12:24 +0300 Subject: [PATCH] Fix `from database` column in dataframe to align with first item of `from key`. --- setup.py | 2 +- unfold/__init__.py | 2 +- unfold/unfold.py | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 5ee022e..86197e4 100644 --- a/setup.py +++ b/setup.py @@ -32,7 +32,7 @@ def package_files(directory): setup( name="unfold", - version="1.2.0", + version="1.2.1", python_requires=">=3.10", packages=packages, author="Romain Sacchi ", diff --git a/unfold/__init__.py b/unfold/__init__.py index 42e44b4..6e4b772 100644 --- a/unfold/__init__.py +++ b/unfold/__init__.py @@ -1,5 +1,5 @@ __all__ = ("Unfold", "Fold") -__version__ = (1, 2, 0) +__version__ = (1, 2, 1) from .fold import Fold diff --git a/unfold/unfold.py b/unfold/unfold.py index 819f8c2..1a39f6d 100644 --- a/unfold/unfold.py +++ b/unfold/unfold.py @@ -1197,9 +1197,13 @@ def format_superstructure_dataframe(self) -> None: self.name or self.package.descriptor["name"] ) + # "from database" equals first item in "from key" self.scenario_df.loc[ (self.scenario_df["flow type"] == "biosphere"), "from database" - ] = "biosphere3" + ] = self.scenario_df.loc[ + (self.scenario_df["flow type"] == "biosphere"), "from key" + ].apply(lambda x: x[0] if x is not None else None) + self.scenario_df = self.scenario_df[ [ "from activity name",