Skip to content

    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 tilesets (i.e., map styles) or a custom tileset URL. The following tilesets 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

    Source: Domino

    Installation

    $ pip install folium

    or

    $ conda install -c conda-forge folium

    Additional Resources