Skip to content

Commit e01bb7a

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 20ba197 commit e01bb7a

3 files changed

Lines changed: 18 additions & 12 deletions

File tree

docs/user-guide/add-region.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,11 @@
112112
" )\n",
113113
" g = sns.FacetGrid(data=sector_capacity, col=\"region\")\n",
114114
" g.map_dataframe(\n",
115-
" lambda data, **kwargs: data.pivot(\n",
116-
" index=\"year\", columns=\"technology\", values=\"capacity\"\n",
115+
" lambda data, **kwargs: (\n",
116+
" data.pivot(index=\"year\", columns=\"technology\", values=\"capacity\")\n",
117+
" .reindex(all_years)\n",
118+
" .plot(kind=\"bar\", stacked=True, ax=plt.gca())\n",
117119
" )\n",
118-
" .reindex(all_years)\n",
119-
" .plot(kind=\"bar\", stacked=True, ax=plt.gca())\n",
120120
" )\n",
121121
" g.add_legend()\n",
122122
" g.set_ylabels(\"Capacity (PJ)\")\n",

src/muse/outputs/cache.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -384,10 +384,12 @@ def check_col(colname: str) -> str:
384384
return colname
385385

386386
return reduce(
387-
lambda left, right: pd.DataFrame.merge(left, right, how="outer", on=cols)
388-
.T.groupby(check_col)
389-
.last()
390-
.T,
387+
lambda left, right: (
388+
pd.DataFrame.merge(left, right, how="outer", on=cols)
389+
.T.groupby(check_col)
390+
.last()
391+
.T
392+
),
391393
data,
392394
)
393395

tests/test_minimum_service.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,14 @@ def test_minimum_service_factor(check_mock, tmp_path, minimum_service_factors):
7171
for process, service_factor in zip(processes, minimum_service_factors):
7272
supply_process = supply[supply.technology == process]
7373
supply_process.loc[:, "min_supply"] = supply_process.apply(
74-
lambda x: x.capacity
75-
* service_factor[x.timeslice]
76-
* float(
77-
techno_out[techno_out.ProcessName == process]["electricity"].values[0]
74+
lambda x: (
75+
x.capacity
76+
* service_factor[x.timeslice]
77+
* float(
78+
techno_out[techno_out.ProcessName == process]["electricity"].values[
79+
0
80+
]
81+
)
7882
),
7983
axis=1,
8084
)

0 commit comments

Comments
 (0)