@@ -23,18 +23,21 @@ def _create_us_counties_df(st_to_state_name_dict, state_to_st_dict):
2323 abs_file_path = os .path .realpath (__file__ )
2424 abs_dir_path = os .path .dirname (abs_file_path )
2525
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' )
2830
2931 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+
3134 df_shape_pre2010 = gp .read_file (shape_pre2010 )
3235 df_shape_pre2010 ['FIPS' ] = (df_shape_pre2010 ['STATE' ] +
3336 df_shape_pre2010 ['COUNTY' ])
3437 df_shape_pre2010 ['FIPS' ] = pd .to_numeric (df_shape_pre2010 ['FIPS' ])
3538
3639 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 )
3841
3942 # state df
4043 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):
4649 'cb_2016_us_county_500k.shx' ]
4750
4851 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 ])
5053
5154 dbf = io .open (filenames [0 ], 'rb' )
5255 shp = io .open (filenames [1 ], 'rb' )
0 commit comments