Python Forum
no image displayed with folium and pandas
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
no image displayed with folium and pandas
#1
Hi,
I am trying to use folium and pandas and I ran the following script under ubuntu 18 with python3 under geany :

#! python3
# coding: utf-8

'''
https://www.pluralsight.com/guides/map-visualizations-in-python-using-folium
'''

import os.path, sys
import folium
import pandas

racine = '/mnt/0ea0b27f-3be6-4d2c-b157-a62559e56142/'
fich_csv = 'python3/prog/gpx/csvfile'

franchises = pandas.read_csv(racine+fich_csv)
print("--", franchises)
#view the dataset
franchises.head()

center = [-0.023559, 37.9061928]
map_kenya = folium.Map(location=center, zoom_start=8)
#display map
map_kenya

for index, franchise in franchises.iterrows():
    location = [franchise['latitude'], franchise['longitude']]
    folium.Marker(location, popup = f'Name:{franchise["store"]}\n Revenue($):{franchise["revenue"]}').add_to(map_kenya)

#display the map
map_kenya
My problem : nothing is displayed.

Thanks for your help
Reply
#2
(Oct-28-2020, 03:09 PM)Declaix Wrote: My problem : nothing is displayed.
I guess you running it as a plain Python script?
This in meant to be run in notebook environment like Jupyter Notebooks or Google colab(has folium pre-installed).

Doc folium
So to display it without Notebook can save as html.
m.save('index.html')
Then open that html file to get same display as in Notebook.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How can draw a real-time marker on map using folium/leaflet Jupyter notebook C3PO 0 2,389 Dec-22-2020, 07:04 PM
Last Post: C3PO
  Folium: HeatMapWithTime is not displaying data point Vreni 0 5,683 Jun-06-2018, 07:24 AM
Last Post: Vreni
  Folium FastMarkerCluster OgnjanD 0 5,561 Jun-01-2018, 06:20 PM
Last Post: OgnjanD

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020