// Take the messy free-form construction_type and plant_kind fields, and
// do our best to map them to some canonical categories... this is
// necessarily imperfect:
pipe(pudl.helpers.cleanstrings, ["type_const", "plant_kind"],
[pc.ferc1_const_type_strings, pc.ferc1_plant_kind_strings],
unmapped="")
)
// Force the construction and installation years to be numeric values, and
// set them to NA if they can"t be converted. (table has some junk values)
ferc1_steam_df["yr_const"] = pd.to_numeric(
ferc1_steam_df["yr_const"], errors="coerce")
ferc1_steam_df["yr_installed"] = pd.to_numeric(
ferc1_steam_df["yr_installed"], errors="coerce")
// There are also a few zeroes... which are not valid years for us:
ferc1_steam_df = ferc1_steam_df.replace(
{"yr_const": 0, "yr_installed": 0}, np.nan)
// Converting everything to per MW and MWh units...
ferc1_steam_df["cost_per_mw"] = 1000 * ferc1_steam_df["cost_per_kw"]
ferc1_steam_df.drop("cost_per_kw", axis=1, inplace=True)
ferc1_steam_df["net_generation_mwh"] = ferc1_steam_df["net_generation"] / 1000
ferc1_steam_df.drop("net_generation", axis=1, inplace=True)
ferc1_steam_df["expns_per_mwh"] = 1000 * ferc1_steam_df["expns_kwh"]