Skip to content

Commit e61f88b

Browse files
committed
fixed py2/3 io.open
1 parent 02a3b9f commit e61f88b

File tree

6 files changed

+5
-5
lines changed

6 files changed

+5
-5
lines changed

plotly/figure_factory/_county_choropleth.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from plotly.figure_factory import utils
44

5+
import io
56
import numpy as np
67
import pandas as pd
78
import warnings
@@ -37,16 +38,15 @@ def _create_us_counties_df(st_to_state_name_dict, state_to_st_dict):
3738

3839
county_url = 'plotly/package_data/data/cb_2016_us_county_500k/'
3940
filenames = ['cb_2016_us_county_500k.dbf',
40-
'cb_2016_us_county_500k.prj',
4141
'cb_2016_us_county_500k.shp',
4242
'cb_2016_us_county_500k.shx']
4343

4444
for j in range(len(filenames)):
4545
filenames[j] = county_url + filenames[j]
4646

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')
5050

5151
r = shapefile.Reader(shp=shp, shx=shx, dbf=dbf)
5252

@@ -557,7 +557,7 @@ def create_choropleth(fips, values, scope=['usa'], binning_endpoints=None,
557557
"""
558558
# ensure optional modules imported
559559
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 "
561561
"installed for this figure factory")
562562

563563
df, df_state = _create_us_counties_df(st_to_state_name_dict,

plotly/package_data/data/cb_2016_us_county_500k/cb_2016_us_county_500k.cpg

100755100644
File mode changed.
Binary file not shown.

plotly/package_data/data/cb_2016_us_county_500k/cb_2016_us_county_500k.prj

100755100644
File mode changed.

plotly/package_data/data/cb_2016_us_county_500k/cb_2016_us_county_500k.shp

100755100644
File mode changed.

plotly/package_data/data/cb_2016_us_county_500k/cb_2016_us_county_500k.shx

100755100644
File mode changed.

0 commit comments

Comments
 (0)