Skip to content

Commit

Permalink
Merge pull request #3013 from catalyst-cooperative/fix-reporting_freq…
Browse files Browse the repository at this point in the history
…uency_code

only fix a reporting_frequency_code when the column exists
  • Loading branch information
zaneselvans authored Nov 7, 2023
2 parents 51be942 + 5a96335 commit f251def
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
7 changes: 4 additions & 3 deletions src/pudl/extract/eia923.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ def process_raw(self, df, page, **partition):
df = remove_leading_zeros_from_numeric_strings(df=df, col_name=col)
df = self.add_data_maturity(df, page, **partition)
# Fill in blank reporting_frequency_code for monthly data
df.loc[
df["data_maturity"] == "incremental_ytd", "reporting_frequency_code"
] = "M"
if "reporting_frequency_code" in df.columns:
df.loc[
df["data_maturity"] == "incremental_ytd", "reporting_frequency_code"
] = "M"
# the 2021 early release data had some ding dang "."'s and nulls in the year column
if "report_year" in df.columns:
mask = (df.report_year == ".") | df.report_year.isnull()
Expand Down
4 changes: 2 additions & 2 deletions test/validate/mcoe_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ def test_no_null_rows_mcoe(pudl_out_mcoe, live_dbs, df_name, thresh):
("hr_by_unit", 387_694, 32_416),
("hr_by_gen", 599_496, 50_070),
("fuel_cost", 599_496, 50_070),
("capacity_factor", 5_178_892, 433_277),
("mcoe", 5_179_300, 433_311),
("capacity_factor", 5_178_828, 433_286),
("mcoe", 5_179_236, 433_320),
],
)
def test_minmax_rows_mcoe(pudl_out_mcoe, live_dbs, monthly_rows, annual_rows, df_name):
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ commands =
{[testenv:unit]commands}
{[testenv:integration]commands}
bash -c 'rm -f tox-nuke.log'
bash -c 'coverage run --append src/pudl/convert/ferc_to_sqlite.py --logfile tox-nuke.log --clobber src/pudl/package_data/settings/etl_full.yml'
bash -c 'coverage run --append src/pudl/cli/etl.py --logfile tox-nuke.log --clobber src/pudl/package_data/settings/etl_full.yml'
bash -c 'coverage run --append src/pudl/ferc_to_sqlite/cli.py --logfile tox-nuke.log --clobber src/pudl/package_data/settings/etl_full.yml'
bash -c 'coverage run --append src/pudl/cli/etl.py --logfile tox-nuke.log src/pudl/package_data/settings/etl_full.yml'
pytest {tty:--color=yes} --live-dbs {posargs} {[testenv]covargs} \
--etl-settings src/pudl/package_data/settings/etl_full.yml \
test/integration
Expand Down

0 comments on commit f251def

Please sign in to comment.