1
1
# -*- coding: utf-8 -*-
2
2
3
3
import re
4
- from delphi_utils import GeoMapper
5
4
import pandas as pd
6
5
import numpy as np
6
+ from delphi_utils import GeoMapper
7
7
8
8
def detect_date_col (col_name : str ):
9
9
"""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 )
11
11
if date_match :
12
12
return True
13
13
return False
@@ -51,9 +51,6 @@ def pull_jhu_data(base_url: str, metric: str, pop_df: pd.DataFrame) -> pd.DataFr
51
51
pd.DataFrame
52
52
Dataframe as described above.
53
53
"""
54
- # Two metrics, two schema...
55
- MIN_FIPS = 1000
56
- MAX_FIPS = 73000
57
54
58
55
# Read data
59
56
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
70
67
)
71
68
df ["timestamp" ] = pd .to_datetime (df ["timestamp" ])
72
69
73
-
74
70
gmpr = GeoMapper ()
75
71
df = gmpr .jhu_uid_to_county (df , jhu_col = "UID" , date_col = 'timestamp' )
76
72
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
- """
88
73
# Merge in population LOWERCASE, consistent across confirmed and deaths
89
74
# Set population as NAN for fake fips
90
75
pop_df .rename (columns = {'FIPS' :'fips' }, inplace = True )
0 commit comments