Skip to content

Commit 6ab5397

Browse files
authored
Merge pull request #456 from BibMartin/fix/issue402
Fix key error in choropleth (#402)
2 parents 5022673 + 6099226 commit 6ab5397

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

examples/choropleth_counties.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def set_id(fips):
2929

3030
# Apply set_id, drop NaN.
3131
df['GEO_ID'] = df['FIPS_Code'].apply(set_id)
32-
df = df.dropna()
32+
df.dropna(subset=['GEO_ID'], inplace=True)
3333

3434
# Number of employed with auto scale.
3535
map_1 = folium.Map(location=[48, -102], zoom_start=3)

folium/folium.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,7 @@ def get_by_key(obj, key):
664664
def color_scale_fun(x):
665665
return color_range[len(
666666
[u for u in color_domain if
667+
get_by_key(x, key_on) in color_data and
667668
u <= color_data[get_by_key(x, key_on)]])]
668669
else:
669670
def color_scale_fun(x):

0 commit comments

Comments
 (0)