Skip to content

Commit

Permalink
Replace [column] access with .loc[:, column]
Browse files Browse the repository at this point in the history
At least in the places where I noticed.
This makes it easier to see, whether the indexing is done into a
dictionary, `Series` or list, i.e. a normally one dimensional structure,
or a `DataFrame`, which is always two dimensional.
  • Loading branch information
gnn committed Feb 16, 2023
1 parent 2c44f6d commit 0b3c8dc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/egon/data/datasets/pypsaeursec/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ def neighbor_reduction():
engine = db.engine()

neighbors.loc[:, "scn_name"] = "eGon100RE"
neighbors.index = neighbors["new_index"]
neighbors.index = neighbors.loc[:, "new_index"]

# Correct geometry for non AC buses
carriers = set(neighbors.carrier.to_list())
Expand Down Expand Up @@ -610,10 +610,10 @@ def neighbor_reduction():
# prepare and write neighboring crossborder lines to etrago tables
def lines_to_etrago(neighbor_lines=neighbor_lines, scn="eGon100RE"):
neighbor_lines.loc[:, "scn_name"] = scn
neighbor_lines.loc[:, "cables"] = 3 * neighbor_lines[
"num_parallel"
neighbor_lines.loc[:, "cables"] = 3 * neighbor_lines.loc[
:, "num_parallel"
].astype(int)
neighbor_lines.loc[:, "s_nom"] = neighbor_lines["s_nom_min"]
neighbor_lines.loc[:, "s_nom"] = neighbor_lines.loc[:, "s_nom_min"]

for i in [
"name",
Expand Down Expand Up @@ -809,7 +809,7 @@ def links_to_etrago(neighbor_links, scn="eGon100RE", extendable=True):

# prepare neighboring generators for etrago tables
neighbor_gens.loc[:, "scn_name"] = "eGon100RE"
neighbor_gens.loc[:, "p_nom"] = neighbor_gens["p_nom_opt"]
neighbor_gens.loc[:, "p_nom"] = neighbor_gens.loc[:, "p_nom_opt"]
neighbor_gens.loc[:, "p_nom_extendable"] = False

# Unify carrier names
Expand Down

0 comments on commit 0b3c8dc

Please sign in to comment.