I try to create multiple lines from a Dataframe in JupyterLab while looping. I have created the following code but every time I try to run it, my Jupyter Notebook crashes and tell me that the Kernel has died. What am I missing here?
m = folium.Map(location=[VstBreitengrad, VstLängengrad], max_zoom=20, zoom_start=5)
for index, row in dfFilter.iterrows():
Breitengrad = row["Breitengrad_x"]
Längengrad = row["Längengrad_x"]
coordinates = [
[Breitengrad, Längengrad],
[20, 20]
]
folium.PolyLine(
locations=coordinates,
color="#FF0000",
weight=5,
).add_to(m)
m
Breitengrad_x and Längengrad_x are the columns in the dataframe from where I'll get the coordinates. If I hardcode the coordinates like
Breitengrad = 50 #row["Breitengrad_x"]
Längengrad = 20 #row["Längengrad_x"]
the code runs without a problem. Thanks a lot for your ideas / solutions.

Assuming the dtype of
Breitengrad_xisint64,row["Breitengrad_x"]will give you a value of typenumpy.int64. That's what may be causing the problem, since your code runs with the hardcoded values.Tox fix it, try converting the values into regular
int: