Skip to content

Gradient parameter in heatmap in newest version can't work-'float' object has no attribute 'split' #2098

Closed
@wybert

Description

@wybert

The gradient parameter in heatmap seems can't work in version since0.19.0. To reproduce, use the following code, or in colab

data = (
    np.random.normal(size=(100, 3)) * np.array([[1, 1, 1]]) + np.array([[48, 5, 1]])
).tolist()

import folium
from folium.plugins import HeatMap

m = folium.Map([48.0, 5.0], zoom_start=6)

HeatMap(data,
        gradient = {0.4: "blue", 0.6: "cyan",
                    0.7: "lime", 0.8: "yellow", 1: "red"}
        ).add_to(m)

m

In newest version 0.19.4 the error is show below,

AttributeError                            Traceback (most recent call last)
[/usr/local/lib/python3.11/dist-packages/IPython/core/formatters.py](https://localhost:8080/#) in __call__(self, obj)
    343             method = get_real_method(obj, self.print_method)
    344             if method is not None:
--> 345                 return method()
    346             return None
    347         else:

13 frames
<template> in macro(l_1_this, l_1_kwargs)

[/usr/local/lib/python3.11/dist-packages/folium/utilities.py](https://localhost:8080/#) in camelize(key)
    347     'variableName'
    348     """
--> 349     return "".join(x.capitalize() if i > 0 else x for i, x in enumerate(key.split("_")))
    350 
    351 
AttributeError: 'float' object has no attribute 'split'
<folium.folium.Map at 0x7dff47d57990>

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions