Choropleth: add message when key_on not found in data
Raise a value error when the `key_on` parameter was not found in the geojson data in Choropleth.
@@ -1109,6 +1109,8 @@ class Choropleth(FeatureGroup):
def color_scale_fun(x):
key_of_x = get_by_key(x, key_on)
+ if not key_of_x:
+ raise ValueError("key_on `{!r}` not found in GeoJSON.".format(key_on))
if key_of_x not in color_data.keys():
return nan_fill_color, nan_fill_opacity
