Skip to content

Commit

Permalink
Avoid DataFrame.groupby(*args, axis=1, **kwargs)
Browse files Browse the repository at this point in the history
DataFrame.groupby with axis=1 is deprecated. The message says to do
`frame.T.groupby(...)` without axis instead. So did I.
  • Loading branch information
p-snft committed Oct 12, 2023
1 parent 240746c commit 442c3a6
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/oemof/solph/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ def net_storage_flow(results, node_type):
dataframes = []

for lb in labels:
subset = df.groupby(
subset = df.T.groupby(
lambda x1: (
lambda fr, to, ty: "output"
if (fr == lb and ty == "flow")
Expand All @@ -415,9 +415,8 @@ def net_storage_flow(results, node_type):
else "level"
if (fr == lb and ty != "flow")
else None
)(*x1),
axis=1,
).sum()
)(*x1)
).sum().T

subset["net_flow"] = subset["output"] - subset["input"]

Expand Down

0 comments on commit 442c3a6

Please sign in to comment.