Python Forum
no image displayed with folium and pandas - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Data Science (https://python-forum.io/forum-44.html)
+--- Thread: no image displayed with folium and pandas (/thread-30618.html)



no image displayed with folium and pandas - Declaix - Oct-28-2020

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


RE: no image displayed with folium and pandas - snippsat - Oct-29-2020

(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.