Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repos:
- id: trailing-whitespace
- id: end-of-file-fixer
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.11
rev: v0.15.0
hooks:
- id: ruff-format
types_or: [python, pyi, jupyter]
Expand All @@ -21,7 +21,7 @@ repos:
hooks:
- id: markdownlint-fix
- repo: https://github.com/kynan/nbstripout
rev: 0.8.2
rev: 0.9.0
hooks:
- id: nbstripout
files: ".ipynb"
Expand Down
8 changes: 4 additions & 4 deletions docs/user-guide/add-region.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@
" )\n",
" g = sns.FacetGrid(data=sector_capacity, col=\"region\")\n",
" g.map_dataframe(\n",
" lambda data, **kwargs: data.pivot(\n",
" index=\"year\", columns=\"technology\", values=\"capacity\"\n",
" lambda data, **kwargs: (\n",
" data.pivot(index=\"year\", columns=\"technology\", values=\"capacity\")\n",
" .reindex(all_years)\n",
" .plot(kind=\"bar\", stacked=True, ax=plt.gca())\n",
" )\n",
" .reindex(all_years)\n",
" .plot(kind=\"bar\", stacked=True, ax=plt.gca())\n",
" )\n",
" g.add_legend()\n",
" g.set_ylabels(\"Capacity (PJ)\")\n",
Expand Down
10 changes: 6 additions & 4 deletions src/muse/outputs/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,12 @@ def check_col(colname: str) -> str:
return colname

return reduce(
lambda left, right: pd.DataFrame.merge(left, right, how="outer", on=cols)
.T.groupby(check_col)
.last()
.T,
lambda left, right: (
pd.DataFrame.merge(left, right, how="outer", on=cols)
.T.groupby(check_col)
.last()
.T
),
data,
)

Expand Down
12 changes: 8 additions & 4 deletions tests/test_minimum_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,14 @@ def test_minimum_service_factor(check_mock, tmp_path, minimum_service_factors):
for process, service_factor in zip(processes, minimum_service_factors):
supply_process = supply[supply.technology == process]
supply_process.loc[:, "min_supply"] = supply_process.apply(
lambda x: x.capacity
* service_factor[x.timeslice]
* float(
techno_out[techno_out.ProcessName == process]["electricity"].values[0]
lambda x: (
x.capacity
* service_factor[x.timeslice]
* float(
techno_out[techno_out.ProcessName == process]["electricity"].values[
0
]
)
),
axis=1,
)
Expand Down
Loading