Skip to content

Commit 18ecd5d

Browse files
COMPAT: explictly cast numpy floats to native floats (#163)
* COMPAT: explictly cast numpy floats to native floats * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 32cd619 commit 18ecd5d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

branca/colormap.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,13 @@ def __init__(self, vmin=0.0, vmax=1.0, caption="", max_labels=10):
9595
def render(self, **kwargs):
9696
"""Renders the HTML representation of the element."""
9797
self.color_domain = [
98-
self.vmin + (self.vmax - self.vmin) * k / 499.0 for k in range(500)
98+
float(self.vmin + (self.vmax - self.vmin) * k / 499.0) for k in range(500)
9999
]
100100
self.color_range = [self.__call__(x) for x in self.color_domain]
101+
102+
# sanitize possible numpy floats to native python floats
103+
self.index = [float(i) for i in self.index]
104+
101105
if self.tick_labels is None:
102106
self.tick_labels = legend_scaler(self.index, self.max_labels)
103107

0 commit comments

Comments
 (0)