def test_map_wake_by_tract(self): # Counties in Raleigh-Durham DMA # df, countyfips = get_dma_data('RALEIGH (NC) - DURHAM (NC) - FAYETTEVILLE (NC)', state="NC") countyfips = [183] df, bounds = get_bounding_box(state=37, counties=countyfips) ax, fig, map = make_map(bounds) draw_tract_data(ax, map, fig, counties=countyfips) plt.show() fig.savefig('census_NC_tracts.png')
def test_map_central_NC_counties(self): countylist = [ 183, 63, 37, 51, 65, 69, 77, 83, 85, 93, 101, 105, 127, 131, 135, 145, 163, 181, 185, 191, 195 ] df, bounds = get_bounding_box(state=37, counties=countylist) ax, fig, map = make_map(bounds) draw_tract_data(ax, map, fig, counties=countylist) plt.show() fig.savefig('census_NC_tracts.png')
def test_map_NC_tracts(self): df, bounds = get_bounding_box(state=37) ax, fig, map = make_map(bounds) data = draw_tract_data(ax, map, fig) df = pd.DataFrame(data.values()) df.to_excel("NC_tracts.xlsx") plt.show() fig.savefig('census_NC_tracts.png')
def test_map_central_NC_tracts(self): #Counties in Raleigh-Durham DMA df, countyfips = get_dma_data( 'RALEIGH (NC) - DURHAM (NC) - FAYETTEVILLE (NC)', state="NC") df_geo, bounds = get_bounding_box(state=37, counties=countyfips) ax, fig, map = make_map(bounds) data = draw_tract_data(ax, map, fig, counties=countyfips) df_response = pd.DataFrame.from_dict(data, orient='index') atoms = [] for county in countyfips: atoms.append(f'county == "{county:03}"') df_response.query(" or ".join(atoms), inplace=True) df_response.to_excel("central_nc_tracts.xlsx") plt.show() fig.savefig('census_central_NC_tracts.png')
def test_NC_tracts_xsls(self): df_geo, bounds = get_bounding_box(state=37) ax, fig, map = make_map(bounds) data = draw_tract_data(ax, map, fig) df_response = pd.DataFrame.from_dict(data, orient='index') df_response.to_excel("nc_tracts.xlsx")