|
2 | 2 |
|
3 | 3 | from plotly.figure_factory import utils
|
4 | 4 |
|
| 5 | +import io |
5 | 6 | import numpy as np
|
6 | 7 | import pandas as pd
|
7 | 8 | import warnings
|
@@ -37,16 +38,15 @@ def _create_us_counties_df(st_to_state_name_dict, state_to_st_dict):
|
37 | 38 |
|
38 | 39 | county_url = 'plotly/package_data/data/cb_2016_us_county_500k/'
|
39 | 40 | filenames = ['cb_2016_us_county_500k.dbf',
|
40 |
| - 'cb_2016_us_county_500k.prj', |
41 | 41 | 'cb_2016_us_county_500k.shp',
|
42 | 42 | 'cb_2016_us_county_500k.shx']
|
43 | 43 |
|
44 | 44 | for j in range(len(filenames)):
|
45 | 45 | filenames[j] = county_url + filenames[j]
|
46 | 46 |
|
47 |
| - dbf = open(filenames[0], 'r') |
48 |
| - shp = open(filenames[2], 'r') |
49 |
| - shx = open(filenames[3], 'r') |
| 47 | + dbf = io.open(filenames[0], 'rb') |
| 48 | + shp = io.open(filenames[1], 'rb') |
| 49 | + shx = io.open(filenames[2], 'rb') |
50 | 50 |
|
51 | 51 | r = shapefile.Reader(shp=shp, shx=shx, dbf=dbf)
|
52 | 52 |
|
@@ -557,7 +557,7 @@ def create_choropleth(fips, values, scope=['usa'], binning_endpoints=None,
|
557 | 557 | """
|
558 | 558 | # ensure optional modules imported
|
559 | 559 | if not gp or not shapefile or not shapely:
|
560 |
| - raise ImportError("geopandas, shapefile and shapely must be " |
| 560 | + raise ImportError("geopandas, pyshp and shapely must be " |
561 | 561 | "installed for this figure factory")
|
562 | 562 |
|
563 | 563 | df, df_state = _create_us_counties_df(st_to_state_name_dict,
|
|
0 commit comments