Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
benhammondmusic committed Jun 13, 2024
1 parent dbce379 commit 7023c35
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions python/ingestion/merge_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import ingestion.standardized_columns as std_col

from ingestion.constants import US_FIPS, US_NAME, US_ABBR, COUNTY_LEVEL, NATIONAL_LEVEL, STATE_LEVEL, ALL_VALUE
from typing import Literal, List, Union, Type, Optional
from typing import Literal, List, Union, Type, Optional, Tuple, Dict
import os

ACS_EARLIEST_YEAR = '2009'
Expand Down Expand Up @@ -331,7 +331,7 @@ def merge_intersectional_pop(
race_specific_group: Optional[str] = None,
age_specific_group: Optional[str] = None,
sex_specific_group: Optional[str] = None,
) -> tuple[pd.DataFrame, str]:
) -> Tuple[pd.DataFrame, str]:
"""
Merges specific cross-section pop from ACS, for later use with dataset_utils.generate_estimated_total_col()
Expand All @@ -355,7 +355,7 @@ def merge_intersectional_pop(
if primary_demo_col == std_col.RACE_COL:
primary_demo_col = 'race_and_ethnicity'

pop_dtype: dict[str, Union[Type[float], Type[str]]] = {
pop_dtype: Dict[str, Union[Type[float], Type[str]]] = {
std_col.POPULATION_COL: float,
}

Expand Down Expand Up @@ -425,7 +425,7 @@ def merge_intersectional_pop(

if primary_demo_col == std_col.RACE_OR_HISPANIC_COL:
merge_cols.append(std_col.RACE_CATEGORY_ID_COL)
if std_col.RACE_OR_HISPANIC_COL in df.columns:
if std_col.RACE_OR_HISPANIC_COL in df.columns and std_col.RACE_OR_HISPANIC_COL in pop_df.columns:
merge_cols.append(std_col.RACE_OR_HISPANIC_COL)
else:
merge_cols.append(primary_demo_col)
Expand Down
10 changes: 5 additions & 5 deletions python/tests/ingestion/test_merge_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

import json
from io import StringIO
from pandas.testing import assert_frame_equal
from ingestion import gcs_to_bq_util, merge_utils
import ingestion.standardized_columns as std_col
import numpy as np
import pandas as pd
from pandas.testing import assert_frame_equal # type: ignore
from ingestion import gcs_to_bq_util, merge_utils # type: ignore
import ingestion.standardized_columns as std_col # type: ignore
import numpy as np # type: ignore
import pandas as pd # type: ignore


_data_with_bad_county_names = [
Expand Down

0 comments on commit 7023c35

Please sign in to comment.