Пример #1
0
df.drop('M_X', axis=1, inplace=True)
df.drop('MME_Conversion_Factor', axis=1, inplace=True)
##########################





"""STEP 4

importing API data for fip codes and population

"""
##########################
#import fips and state populations
county_pop = arcospy.county_population(state="AL", key="WaPo")
county_pop.head()

#delete first two numbers in the countyfips to make room for the state
county_pop['countyfips'] = county_pop['countyfips'].str[2:]

#replace first two digits in country fips with buyer state
county_pop['FIP_CODE'] = county_pop['BUYER_STATE'] + county_pop['countyfips'] 

#dropping unnecessary variables from countypop before merge with state CSV
county_pop.drop('STATE', axis=1, inplace=True)
county_pop.drop('COUNTY', axis=1, inplace=True)
county_pop.drop('county_name', axis=1, inplace=True)
county_pop.drop('variable', axis=1, inplace=True)
county_pop.drop('NAME', axis=1, inplace=True)
county_pop.drop('countyfips', axis=1, inplace=True)
Пример #2
0



state_ab = ["AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DC", "DE", "FL", "GA", 
          "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", 
          "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ", 
          "NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC", 
          "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY"]




# Step 1.A

county_info_AL = arcospy.county_population(state=["AL"], key="WaPo")
monthly_info_AL = arcospy.summarized_county_monthly(state=["AL"], key="WaPo")

county_info_AK = arcospy.county_population(state=["AK"], key="WaPo")
monthly_info_AK = arcospy.summarized_county_monthly(state=["AK"], key="WaPo")

county_info_AR = arcospy.county_population(state=["AR"], key="WaPo")
monthly_info_AR = arcospy.summarized_county_monthly(state=["AR"], key="WaPo")

county_info_AZ = arcospy.county_population(state=["AZ"], key="WaPo")
monthly_info_AZ = arcospy.summarized_county_monthly(state=["AZ"], key="WaPo")

county_info_CA = arcospy.county_population(state=["CA"], key="WaPo")
monthly_info_CA = arcospy.summarized_county_monthly(state=["CA"], key="WaPo")

county_info_CO = arcospy.county_population(state=["CO"], key="WaPo")
Пример #3
0
)

# Drop first index column as artifact of importing csv
func3_output_R = func3_output_R.drop(func3_output_R.columns[0], axis=1)

# Test function 5: buyer_addresses
func5_output = buyer_addresses(input_county, input_state, input_key)
func5_output_R = pd.read_csv(
    '/home/travis/build/jeffcsauer/arcospy/arcospy/tests/tests_datasets/func5_output.csv'
)

# Drop first index column as artifact of importing csv
func5_output_R = func5_output_R.drop(func5_output_R.columns[0], axis=1)

# Test function 7: county_population
func7_output = county_population(input_county, input_state, input_key)
func7_output_R = pd.read_csv(
    '/home/travis/build/jeffcsauer/arcospy/arcospy/tests/tests_datasets/func7_output.csv'
)

# Drop first index column as artifact of importing csv
func7_output_R = func7_output_R.drop(func7_output_R.columns[0], axis=1)

# Test function 9: not_pharmacies
func9_output = not_pharmacies(input_key)
func9_output_R = pd.read_csv(
    '/home/travis/build/jeffcsauer/arcospy/arcospy/tests/tests_datasets/func9_output.csv'
)

# Drop first index column as artifact of importing csv
func9_output_R = func9_output_R.drop(func9_output_R.columns[0], axis=1)