Skip to content

Commit

Permalink
Update dependencies 2024/04 (#68)
Browse files Browse the repository at this point in the history
* Bump pre-commit action version

* Bump dependency versions

* Workaround upcoming pandas.df.groupby.apply limitation

* remove column copies

* update dask and lock

* put "type" back in map func

* put grouped columns back

* Relax dependency constraints, remove upper bounds

---------

Co-authored-by: Max Wolschlager <comms@meks.io>
  • Loading branch information
glatterf42 and meksor committed Apr 12, 2024
1 parent 34646d2 commit 8b0c1dc
Show file tree
Hide file tree
Showing 5 changed files with 157 additions and 136 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,4 @@ jobs:
#-------------------------------
# run pre-commit/(mypy, ruff)
#-------------------------------
- uses: pre-commit/action@v3.0.0
- uses: pre-commit/action@v3.0.1
6 changes: 5 additions & 1 deletion ixmp4/data/db/iamc/timeseries/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,14 @@ def map_measurand(df):
variable_name=variable_name, unit__id=int(unit__id)
)
df["measurand__id"] = measurand.id
df["variable"] = variable_name
df["unit__id"] = unit__id
return df

return pd.DataFrame(
df.groupby(["variable", "unit__id"], group_keys=False).apply(map_measurand)
df.groupby(["variable", "unit__id"], group_keys=False).apply(
map_measurand, include_groups=False
)
)

def map_relationships(self, df: pd.DataFrame) -> pd.DataFrame:
Expand Down
5 changes: 4 additions & 1 deletion ixmp4/data/db/meta/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,12 @@ def map_value_column(df: pd.DataFrame):
type_ = RunMetaEntry.Type(type_str)
col = RunMetaEntry._column_map[type_]
df["value"] = df[col]
df["type"] = type_str
return df.drop(columns=RunMetaEntry._column_map.values())

return df.groupby("type", group_keys=False).apply(map_value_column)
return df.groupby("type", group_keys=False).apply(
map_value_column, include_groups=False
)

@check_types
@guard("edit")
Expand Down
Loading

0 comments on commit 8b0c1dc

Please sign in to comment.