Skip to content

Commit

Permalink
Instead of changing momentary_interruption_definition to it's label, …
Browse files Browse the repository at this point in the history
…add the encoding step so the code_fixes get applied and the foreign key error isn't tripped
  • Loading branch information
aesharpe committed Aug 14, 2023
1 parent 52ff7f7 commit b9d3228
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/pudl/transform/eia861.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
fix_eia_na,
)
from pudl.metadata.classes import Package
from pudl.metadata.codes import CODE_METADATA
from pudl.metadata.enums import (
CUSTOMER_CLASSES,
FUEL_CLASSES,
Expand Down Expand Up @@ -2262,15 +2261,10 @@ def reliability_eia861(raw_reliability_eia861: pd.DataFrame) -> pd.DataFrame:
.pipe(_drop_dupes, df_name="Reliability", subset=idx_cols).pipe(_post_process)
)

transformed_r[
"momentary_interruption_definition"
] = transformed_r.momentary_interruption_definition.str.upper().map(
pudl.helpers.label_map(
CODE_METADATA["momentary_interruptions_eia"]["df"],
from_col="code",
to_col="label",
null_value=pd.NA,
)
transformed_r = (
pudl.metadata.classes.Package.from_resource_ids()
.get_resource("reliability_eia861")
.encode(transformed_r)
)

return transformed_r
Expand Down

0 comments on commit b9d3228

Please sign in to comment.