Skip to content

Commit

Permalink
fix: ensure type of 'p' is float before numerical processing
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkleiven committed Aug 23, 2024
1 parent 1a8ed90 commit c8084c6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cimsparql/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ def dc_active_flow_query(self, region: str | None = None) -> str:
@time_it
def dc_active_flow(self, region: str | None = None) -> DcActiveFlowDataFrame:
query = self.dc_active_flow_query(region)
df = self.get_table_and_convert(query)
df = self.get_table_and_convert(query).astype({"p": float})
# Unable to group on max within the sparql query so we do it here.
df = df.iloc[df.groupby("mrid")["p"].idxmax()].set_index("mrid")
df["p"] *= df["direction"]
Expand Down

0 comments on commit c8084c6

Please sign in to comment.