Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
466 views
in Technique[技术] by (71.8m points)

pyspark - I got Object Column is not Serializable error when trying to save Ipyleaflet Map with Panda Dataframe

I am trying to plot some data on a Map using Ipyleaflet on Databricks community Notebook I got all the points in a Panda DataFrame but when I pass column to the map and try to save it in a file I got an error

from ipyleaflet import Map,Heatmap
from IPython.display import HTML
from random import uniform
from ipyleaflet import Map, basemaps, basemap_to_tiles
latitudes = trips['start_station_latitude']
longitudes = trips['start_station_longitude']
intensities = trips['count']



m = Map(center=[0, 0], zoom=2)
locations = [
    latitudes.to_json(), longitudes.to_json(), intensities.to_json()
]
heat = Heatmap(locations=locations, radius=20, blur=10)
m.add_layer(heat)

# Change some attributes of the heatmap
heat.radius = 30
heat.blur = 50
heat.max = 0.5
heat.gradient = {0.4: 'red', 0.6: 'yellow', 0.7: 'lime', 0.8: 'cyan', 1.0: 'blue'}

m
m.save("test.html")

HTML(filename="test.html")

When I try to execute I get this error :

enter image description here

Does anyone have any idea about this error ? And is there another method method to plot this map without saving it , I tried to install to jupyter extension but I didn't found how to do it in Databricks Community Platform Thank you everyone

question from:https://stackoverflow.com/questions/65540729/i-got-object-column-is-not-serializable-error-when-trying-to-save-ipyleaflet-map

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...