11# -*- coding: utf-8 -*-
22
33import re
4- from delphi_utils import GeoMapper
54import pandas as pd
65import numpy as np
6+ from delphi_utils import GeoMapper
77
88def detect_date_col (col_name : str ):
99 """determine if column name is a date"""
10- date_match = re .match ('\d{1,2}\/\d{1,2}\/\d{1,2}' , col_name )
10+ date_match = re .match (r '\d{1,2}\/\d{1,2}\/\d{1,2}' , col_name )
1111 if date_match :
1212 return True
1313 return False
@@ -51,9 +51,6 @@ def pull_jhu_data(base_url: str, metric: str, pop_df: pd.DataFrame) -> pd.DataFr
5151 pd.DataFrame
5252 Dataframe as described above.
5353 """
54- # Two metrics, two schema...
55- MIN_FIPS = 1000
56- MAX_FIPS = 73000
5754
5855 # Read data
5956 df = pd .read_csv (base_url .format (metric = metric ))
@@ -70,21 +67,9 @@ def pull_jhu_data(base_url: str, metric: str, pop_df: pd.DataFrame) -> pd.DataFr
7067 )
7168 df ["timestamp" ] = pd .to_datetime (df ["timestamp" ])
7269
73-
7470 gmpr = GeoMapper ()
7571 df = gmpr .jhu_uid_to_county (df , jhu_col = "UID" , date_col = 'timestamp' )
7672
77- """
78- df = df[
79- (
80- (fips_int >= MIN_FIPS) # US non-state territories
81- & (fips_int < MAX_FIPS)
82- ) # "Uncategorized", etc.
83- # Get Fake FIPS for unassigned cases
84- | np.logical_and(fips_int >= 90001,
85- fips_int <= 90056)
86- ]
87- """
8873 # Merge in population LOWERCASE, consistent across confirmed and deaths
8974 # Set population as NAN for fake fips
9075 pop_df .rename (columns = {'FIPS' :'fips' }, inplace = True )
0 commit comments