6a50ac671a17a3820ba273065b5feda54bf73ef4,src/pudl/transform/eia860.py,,ownership,#Any#Any#,14

Before Change


    o_df = eia860_dfs["ownership"].copy()

    // Replace "." and " " with NaN in order to read in integer values
    o_df = pudl.helpers.fix_eia_na(o_df)

    o_df = pudl.helpers.convert_to_date(o_df)

    // The fix we"re making here is only known to be valid for 2011 -- if we
    // get older data... then we need to to revisit the cleaning function and
    // make sure it also applies to those earlier years.
    if min(o_df.report_date.dt.year) < min(pc.working_years["eia860"]):
        raise ValueError(
            f"EIA 860 transform step is only known to work for "
            f"year {min(pc.working_years["eia860"])} and later, but found data "
            f"from year {min(o_df.report_date.dt.year)}."
        )

    // Prior to 2012, ownership was reported as a percentage, rather than
    // as a proportion, so we need to divide those values by 100.
    o_df.loc[o_df.report_date.dt.year == 2011, "fraction_owned"] = \
        o_df.loc[o_df.report_date.dt.year == 2011, "fraction_owned"] / 100

    o_df["owner_utility_id_eia"] = o_df["owner_utility_id_eia"].astype(int)
    o_df["utility_id_eia"] = o_df["utility_id_eia"].astype(int)
    o_df["plant_id_eia"] = o_df["plant_id_eia"].astype(int)

    eia860_transformed_dfs["ownership_eia860"] = o_df

    return eia860_transformed_dfs

After Change


        DataFrames of values from that page (values)

    
    o_df = (
        eia860_dfs["ownership"].copy()
        .pipe(pudl.helpers.fix_eia_na)
        .pipe(pudl.helpers.convert_to_date)
    )

    // The fix we"re making here is only known to be valid for 2011 -- if we
    // get older data... then we need to to revisit the cleaning function and
    // make sure it also applies to those earlier years.
    if min(o_df.report_date.dt.year) < min(pc.working_years["eia860"]):
        raise ValueError(
            f"EIA 860 transform step is only known to work for "
            f"year {min(pc.working_years["eia860"])} and later, but found data "
            f"from year {min(o_df.report_date.dt.year)}."
        )

    // Prior to 2012, ownership was reported as a percentage, rather than
    // as a proportion, so we need to divide those values by 100.
    o_df.loc[o_df.report_date.dt.year == 2011, "fraction_owned"] = \
        o_df.loc[o_df.report_date.dt.year == 2011, "fraction_owned"] / 100

    o_df["owner_utility_id_eia"] = o_df["owner_utility_id_eia"].astype(int)
    o_df["utility_id_eia"] = o_df["utility_id_eia"].astype(int)
    o_df["plant_id_eia"] = o_df["plant_id_eia"].astype(int)

    eia860_transformed_dfs["ownership_eia860"] = o_df

    return eia860_transformed_dfs
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: catalyst-cooperative/pudl
Commit Name: 6a50ac671a17a3820ba273065b5feda54bf73ef4
Time: 2020-01-16
Author: zane.selvans@catalyst.coop
File Name: src/pudl/transform/eia860.py
Class Name:
Method Name: ownership


Project Name: catalyst-cooperative/pudl
Commit Name: 6aeb7908c1095186ebbb4293d752f10422ae1f10
Time: 2020-02-27
Author: zane.selvans@catalyst.coop
File Name: src/pudl/transform/eia860.py
Class Name:
Method Name: plants


Project Name: catalyst-cooperative/pudl
Commit Name: 590028f40e74f82c3d00f0bc48b4cf415c97bfce
Time: 2019-06-13
Author: zane.selvans@catalyst.coop
File Name: pudl/transform/eia860.py
Class Name:
Method Name: generators