Skip to content

Commit

Permalink
refactor: simplify fillna within transmission dcline function
Browse files Browse the repository at this point in the history
  • Loading branch information
danielolsen committed Jun 24, 2021
1 parent 566a9b0 commit 04b0640
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions powersimdata/design/compare/transmission.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,9 @@ def calculate_dcline_differences(grid1, grid2):
dc_merge = dcline1.merge(
dcline2, how="outer", right_index=True, left_index=True, suffixes=(None, "_2")
)
# fillna for bus ids, since some lines in one frame won't be in the other frame
dc_merge.fillna(
{
"from_lat": dc_merge.from_lat_2,
"from_lon": dc_merge.from_lon_2,
"to_lat": dc_merge.to_lat_2,
"to_lon": dc_merge.to_lon_2,
},
inplace=True,
)
# Calculate differences in Pmax
dc_merge["diff"] = dc_merge.Pmax_2.fillna(0) - dc_merge.Pmax.fillna(0)
# Ensure that lats & lons get filled in as necessary from grid2.dcline entries
for l in ["from_lat", "from_lon", "to_lat", "to_lon"]:
dc_merge[l].fillna(dc_merge[f"{l}_2"], inplace=True)

return dc_merge

0 comments on commit 04b0640

Please sign in to comment.