Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
For more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jul 8, 2024
1 parent 584a487 commit 0a66fe5
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
13 changes: 7 additions & 6 deletions src/pudl_rmi/create_override_spreadsheets.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
validate them, and incorporate them into the existing training data.
"""

import importlib
import logging
import os
Expand Down Expand Up @@ -114,9 +115,9 @@ def _pct_diff(df, col) -> pd.DataFrame:
# Fed in the _pct_diff column so make sure it is neutral for this analysis
col = col.replace("_pct_diff", "")
# Fill in the _pct_diff column with the actual percent difference value
df.loc[
(df[f"{col}_eia"] > 0) & (df[f"{col}_ferc1"] > 0), f"{col}_pct_diff"
] = round(((df[f"{col}_ferc1"] - df[f"{col}_eia"]) / df[f"{col}_ferc1"] * 100), 2)
df.loc[(df[f"{col}_eia"] > 0) & (df[f"{col}_ferc1"] > 0), f"{col}_pct_diff"] = (
round(((df[f"{col}_ferc1"] - df[f"{col}_eia"]) / df[f"{col}_ferc1"] * 100), 2)
)

return df

Expand Down Expand Up @@ -189,9 +190,9 @@ def _prep_ferc1_eia(ferc1_eia, pudl_out) -> pd.DataFrame:
)

# Add in installation_year diff (diff vs. pct_diff)
ferc1_eia_prep.loc[
:, "installation_year_ferc1"
] = ferc1_eia_prep.installation_year_ferc1.astype("Int64")
ferc1_eia_prep.loc[:, "installation_year_ferc1"] = (
ferc1_eia_prep.installation_year_ferc1.astype("Int64")
)

ferc1_eia_prep.loc[
ferc1_eia_prep.installation_year_eia.notna()
Expand Down
6 changes: 3 additions & 3 deletions src/pudl_rmi/formatter_optimus.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ def execute(
model_input.loc[:, "resource_type"] = model_input.technology_description.replace(
TECHNOLOGY_DESCRIPTION_TO_RESOURCE_TYPE
)
model_input.loc[
:, "operational_status"
] = model_input.operational_status.str.title()
model_input.loc[:, "operational_status"] = (
model_input.operational_status.str.title()
)

# Create a bunch of "faked" columns
for faked_col in [x for x in RENAME_COLS.keys() if "faked_" in x]:
Expand Down
1 change: 1 addition & 0 deletions test/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""PyTest configuration module. Defines useful fixtures, command line args."""

import json
import logging
import os
Expand Down
1 change: 1 addition & 0 deletions test/unit/connect_deprish_to_ferc1_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unit tests for connection between Depreciation and FERC1."""

import pandas as pd

from pudl_rmi.connect_deprish_to_ferc1 import allocate_cols
Expand Down

0 comments on commit 0a66fe5

Please sign in to comment.