What is Folium?

Folium is a powerful Python library that helps you create several types of Leaflet maps. By default, Folium creates a map in a separate HTML file. Since Folium results are interactive, this library is very useful for dashboard building. You can also create inline Jupyter maps in Folium.

Folium builds on the data wrangling strengths of the Python ecosystem and the mapping strengths of the Leaflet.js library. Using Folium, you can manipulate your data in Python, then visualize it in a Leaflet map.

Folium enables you to generate a base map of specified width and height with either default map tile sets (i.e., map styles) or a custom tile set URL. The following tile sets are available by default with Folium:

  • OpenStreetMap
  • Mapbox Bright
  • Mapbox Control Room
  • Stamen (incl. Terrain, Toner, and Watercolor)
  • Cloudmade
  • Mapbox
  • CartoDB (incl. positron and dark_matter)

Folium also supports choropleth maps. A choropleth map – from Greek χώρο (“area/region”) + πλήθος (“multitude”) – is a thematic map in which areas are shaded or patterned in proportion to the measurement of the statistical variable being displayed on the map, such as population density or per-capita income.

Choropleth map in Folium with crime statistics

Folium map of San Francisco
Folium map of San Francisco

Source: Domino


$ pip install folium


$ conda install -c conda-forge folium

Additional Resources