Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 065e59c

Browse files
committed
remove unnecessary data files in tests and robust data-path searching
1 parent 77b50f3 commit 065e59c

16 files changed

+10
-2755
lines changed

plotly/figure_factory/_county_choropleth.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import io
66
import numpy as np
7+
import os
78
import pandas as pd
89
import warnings
910

@@ -19,17 +20,23 @@
1920

2021
def _create_us_counties_df(st_to_state_name_dict, state_to_st_dict):
2122
# URLS
22-
data_url = 'plotly/package_data/data/'
23+
abs_file_path = os.path.realpath(__file__)
24+
abs_dir_path = os.path.dirname(abs_file_path)
25+
26+
abs_plotly_dir_path = abs_dir_path[:abs_dir_path.find('/figure_factory')]
27+
abs_data_dir_path = abs_plotly_dir_path + '/package_data/data/'
28+
29+
print abs_data_dir_path
2330

2431
shape_pre2010 = 'gz_2010_us_050_00_500k/gz_2010_us_050_00_500k.shp'
25-
shape_pre2010 = data_url + shape_pre2010
32+
shape_pre2010 = abs_data_dir_path + shape_pre2010
2633
df_shape_pre2010 = gp.read_file(shape_pre2010)
2734
df_shape_pre2010['FIPS'] = (df_shape_pre2010['STATE'] +
2835
df_shape_pre2010['COUNTY'])
2936
df_shape_pre2010['FIPS'] = pd.to_numeric(df_shape_pre2010['FIPS'])
3037

3138
states_path = 'cb_2016_us_state_500k/cb_2016_us_state_500k.shp'
32-
states_path = data_url + states_path
39+
states_path = abs_data_dir_path + states_path
3340

3441
# state df
3542
df_state = gp.read_file(states_path)

plotly/tests/test_optional/test_figure_factory/plotly/package_data/data/cb_2016_us_county_500k/cb_2016_us_county_500k.cpg

Lines changed: 0 additions & 1 deletion
This file was deleted.

plotly/tests/test_optional/test_figure_factory/plotly/package_data/data/cb_2016_us_county_500k/cb_2016_us_county_500k.prj

Lines changed: 0 additions & 1 deletion
This file was deleted.

plotly/tests/test_optional/test_figure_factory/plotly/package_data/data/cb_2016_us_county_500k/cb_2016_us_county_500k.shp

100755100644
File mode changed.

plotly/tests/test_optional/test_figure_factory/plotly/package_data/data/cb_2016_us_county_500k/cb_2016_us_county_500k.shp.ea.iso.xml

Lines changed: 0 additions & 404 deletions
This file was deleted.

plotly/tests/test_optional/test_figure_factory/plotly/package_data/data/cb_2016_us_county_500k/cb_2016_us_county_500k.shp.iso.xml

Lines changed: 0 additions & 539 deletions
This file was deleted.

plotly/tests/test_optional/test_figure_factory/plotly/package_data/data/cb_2016_us_county_500k/cb_2016_us_county_500k.shp.xml

Lines changed: 0 additions & 410 deletions
This file was deleted.

plotly/tests/test_optional/test_figure_factory/plotly/package_data/data/cb_2016_us_county_500k/cb_2016_us_county_500k.shx

100755100644
File mode changed.

plotly/tests/test_optional/test_figure_factory/plotly/package_data/data/cb_2016_us_state_500k/cb_2016_us_state_500k.cpg

Lines changed: 0 additions & 1 deletion
This file was deleted.

plotly/tests/test_optional/test_figure_factory/plotly/package_data/data/cb_2016_us_state_500k/cb_2016_us_state_500k.prj

Lines changed: 0 additions & 1 deletion
This file was deleted.

plotly/tests/test_optional/test_figure_factory/plotly/package_data/data/cb_2016_us_state_500k/cb_2016_us_state_500k.shp.ea.iso.xml

Lines changed: 0 additions & 335 deletions
This file was deleted.

plotly/tests/test_optional/test_figure_factory/plotly/package_data/data/cb_2016_us_state_500k/cb_2016_us_state_500k.shp.iso.xml

Lines changed: 0 additions & 501 deletions
This file was deleted.

plotly/tests/test_optional/test_figure_factory/plotly/package_data/data/cb_2016_us_state_500k/cb_2016_us_state_500k.shp.xml

Lines changed: 0 additions & 329 deletions
This file was deleted.

plotly/tests/test_optional/test_figure_factory/plotly/package_data/data/gz_2010_us_050_00_500k/gz_2010_us_050_00_500k.prj

Lines changed: 0 additions & 1 deletion
This file was deleted.

plotly/tests/test_optional/test_figure_factory/plotly/package_data/data/gz_2010_us_050_00_500k/gz_2010_us_050_00_500k.xml

Lines changed: 0 additions & 229 deletions
This file was deleted.

0 commit comments

Comments
 (0)