def test_get_bounding_box_data(self):
     df, data = get_bounding_box()
     self.assertEqual(len(df), 3221)
     df, data = get_bounding_box(state=37)
     self.assertEqual(len(df), 100)
     df, data = get_bounding_box(state=37, counties=[183, 63])
     self.assertEqual(len(df), 2)
Beispiel #2
0
    def test_map_NC_counties(self):
        df, bounds = get_bounding_box(state=37)

        ax, fig, map = make_map(bounds)
        draw_county_data(ax, map, fig)
        plt.show()
        fig.savefig('census_NC_counties.png')
 def test_map_NC_counties(self):
     df, bounds = get_bounding_box(state=37)
     ax, fig, map = make_map(bounds)
     data = draw_county_data(ax, map, fig)
     df_response = pd.DataFrame.from_dict(data, orient='index')
     df_response.to_excel("nc_counties.xlsx")
     print(df_response)
     plt.show()
     fig.savefig('census_NC_counties.png')
 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')
Beispiel #5
0
 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')
Beispiel #6
0
    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")