Address FutureWarnings in make_summary_perfect
related to groupby
This commit is contained in:
parent
6c7d79f524
commit
7fbb605134
@ -246,8 +246,9 @@ def calculate_energy(n, label, energy):
|
|||||||
.groupby(level=0)
|
.groupby(level=0)
|
||||||
.sum()
|
.sum()
|
||||||
.multiply(c.df.sign)
|
.multiply(c.df.sign)
|
||||||
.groupby(c.df.carrier, axis=1)
|
.T.groupby(c.df.carrier)
|
||||||
.sum()
|
.sum()
|
||||||
|
.T
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
c_energies = pd.DataFrame(
|
c_energies = pd.DataFrame(
|
||||||
@ -394,16 +395,9 @@ def calculate_supply_energy(n, label, supply_energy):
|
|||||||
if len(items) == 0:
|
if len(items) == 0:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
s = (
|
s = (-1) * c.pnl["p" + end].reindex(items, axis=1).multiply(
|
||||||
(-1)
|
n.snapshot_weightings.objective, axis=0
|
||||||
* c.pnl["p" + end]
|
).groupby(level=0).sum().T.groupby(c.df.loc[items, "carrier"]).sum()
|
||||||
.reindex(items, axis=1)
|
|
||||||
.multiply(n.snapshot_weightings.objective, axis=0)
|
|
||||||
.groupby(level=0)
|
|
||||||
.sum()
|
|
||||||
.groupby(c.df.loc[items, "carrier"], axis=1)
|
|
||||||
.sum()
|
|
||||||
).T
|
|
||||||
s.index = s.index + end
|
s.index = s.index + end
|
||||||
s = pd.concat([s], keys=[c.list_name])
|
s = pd.concat([s], keys=[c.list_name])
|
||||||
s = pd.concat([s], keys=[i])
|
s = pd.concat([s], keys=[i])
|
||||||
@ -514,9 +508,7 @@ def calculate_weighted_prices(n, label, weighted_prices):
|
|||||||
if names.empty:
|
if names.empty:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
load += (
|
load += n.links_t.p0[names].T.groupby(n.links.loc[names, "bus0"]).sum()
|
||||||
n.links_t.p0[names].groupby(n.links.loc[names, "bus0"], axis=1).sum()
|
|
||||||
)
|
|
||||||
|
|
||||||
# Add H2 Store when charging
|
# Add H2 Store when charging
|
||||||
# if carrier == "H2":
|
# if carrier == "H2":
|
||||||
@ -557,9 +549,9 @@ def calculate_market_values(n, label, market_values):
|
|||||||
|
|
||||||
dispatch = (
|
dispatch = (
|
||||||
n.generators_t.p[gens]
|
n.generators_t.p[gens]
|
||||||
.groupby(n.generators.loc[gens, "bus"], axis=1)
|
.T.groupby(n.generators.loc[gens, "bus"])
|
||||||
.sum()
|
.sum()
|
||||||
.reindex(columns=buses, fill_value=0.0)
|
.T.reindex(columns=buses, fill_value=0.0)
|
||||||
)
|
)
|
||||||
|
|
||||||
revenue = dispatch * n.buses_t.marginal_price[buses]
|
revenue = dispatch * n.buses_t.marginal_price[buses]
|
||||||
@ -583,9 +575,9 @@ def calculate_market_values(n, label, market_values):
|
|||||||
|
|
||||||
dispatch = (
|
dispatch = (
|
||||||
n.links_t["p" + i][links]
|
n.links_t["p" + i][links]
|
||||||
.groupby(n.links.loc[links, "bus" + i], axis=1)
|
.T.groupby(n.links.loc[links, "bus" + i])
|
||||||
.sum()
|
.sum()
|
||||||
.reindex(columns=buses, fill_value=0.0)
|
.T.reindex(columns=buses, fill_value=0.0)
|
||||||
)
|
)
|
||||||
|
|
||||||
revenue = dispatch * n.buses_t.marginal_price[buses]
|
revenue = dispatch * n.buses_t.marginal_price[buses]
|
||||||
@ -652,7 +644,7 @@ def calculate_co2_emissions(n, label, df):
|
|||||||
emitted = n.generators_t.p[gens.index].mul(em_pu)
|
emitted = n.generators_t.p[gens.index].mul(em_pu)
|
||||||
|
|
||||||
emitted_grouped = (
|
emitted_grouped = (
|
||||||
emitted.groupby(level=0).sum().groupby(n.generators.carrier, axis=1).sum().T
|
emitted.groupby(level=0).sum().T.groupby(n.generators.carrier).sum().T
|
||||||
)
|
)
|
||||||
|
|
||||||
df = df.reindex(emitted_grouped.index.union(df.index))
|
df = df.reindex(emitted_grouped.index.union(df.index))
|
||||||
|
Loading…
Reference in New Issue
Block a user