Folium: ValueError raised when `key_of_x` = 0

Created on 21 Jun 2019  路  2Comments  路  Source: python-visualization/folium

This line:
https://github.com/python-visualization/folium/blob/f05f3ce9b3d71f87a0738f3c8c1236b933e497a9/folium/features.py#L1112
Provokes this ValueError to be raised, not only when key_of_x is None but also when key_of_x == 0 (which I think is a perfectly valid value for a key):
https://github.com/python-visualization/folium/blob/f05f3ce9b3d71f87a0738f3c8c1236b933e497a9/folium/features.py#L1113
Shouldn't this line be if key_of_x is None:?

bug v.patch

Most helpful comment

Yes! Pet peeve of mine, but I like explicit checks for None, this is why. Do you want to make a PR? Maybe add a test?

~In the docstring it says key_on should be a string or None. Should we change that into that it can also be an int?~ That doesn't make sense, we're talking about the key_of_x value here, not key_on.

All 2 comments

Yes! Pet peeve of mine, but I like explicit checks for None, this is why. Do you want to make a PR? Maybe add a test?

~In the docstring it says key_on should be a string or None. Should we change that into that it can also be an int?~ That doesn't make sense, we're talking about the key_of_x value here, not key_on.

I've just made a PR. You might want to check the test I made though since I was not sure how to test the ValueError not being raised.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

themiurgo picture themiurgo  路  19Comments

olibchr picture olibchr  路  19Comments

ElmWer picture ElmWer  路  24Comments

ibayer picture ibayer  路  21Comments

reaganch picture reaganch  路  13Comments