@@ -23,18 +23,21 @@ def _create_us_counties_df(st_to_state_name_dict, state_to_st_dict):
23
23
abs_file_path = os .path .realpath (__file__ )
24
24
abs_dir_path = os .path .dirname (abs_file_path )
25
25
26
- abs_plotly_dir_path = abs_dir_path [:abs_dir_path .find ('/figure_factory' )]
27
- abs_package_data_dir_path = abs_plotly_dir_path + '/package_data/'
26
+ abs_plotly_dir_path = os .path .dirname (abs_dir_path )
27
+
28
+ abs_package_data_dir_path = os .path .join (abs_plotly_dir_path ,
29
+ 'package_data' )
28
30
29
31
shape_pre2010 = 'gz_2010_us_050_00_500k.shp'
30
- shape_pre2010 = abs_package_data_dir_path + shape_pre2010
32
+ shape_pre2010 = os .path .join (abs_package_data_dir_path , shape_pre2010 )
33
+
31
34
df_shape_pre2010 = gp .read_file (shape_pre2010 )
32
35
df_shape_pre2010 ['FIPS' ] = (df_shape_pre2010 ['STATE' ] +
33
36
df_shape_pre2010 ['COUNTY' ])
34
37
df_shape_pre2010 ['FIPS' ] = pd .to_numeric (df_shape_pre2010 ['FIPS' ])
35
38
36
39
states_path = 'cb_2016_us_state_500k.shp'
37
- states_path = abs_package_data_dir_path + states_path
40
+ states_path = os . path . join ( abs_package_data_dir_path , states_path )
38
41
39
42
# state df
40
43
df_state = gp .read_file (states_path )
@@ -46,7 +49,7 @@ def _create_us_counties_df(st_to_state_name_dict, state_to_st_dict):
46
49
'cb_2016_us_county_500k.shx' ]
47
50
48
51
for j in range (len (filenames )):
49
- filenames [j ] = abs_package_data_dir_path + filenames [j ]
52
+ filenames [j ] = os . path . join ( abs_package_data_dir_path , filenames [j ])
50
53
51
54
dbf = io .open (filenames [0 ], 'rb' )
52
55
shp = io .open (filenames [1 ], 'rb' )
0 commit comments