Book Image

Jupyter Cookbook

By : Dan Toomey
Book Image

Jupyter Cookbook

By: Dan Toomey

Overview of this book

Jupyter has garnered a strong interest in the data science community of late, as it makes common data processing and analysis tasks much simpler. This book is for data science professionals who want to master various tasks related to Jupyter to create efficient, easy-to-share, scientific applications. The book starts with recipes on installing and running the Jupyter Notebook system on various platforms and configuring the various packages that can be used with it. You will then see how you can implement different programming languages and frameworks, such as Python, R, Julia, JavaScript, Scala, and Spark on your Jupyter Notebook. This book contains intuitive recipes on building interactive widgets to manipulate and visualize data in real time, sharing your code, creating a multi-user environment, and organizing your notebook. You will then get hands-on experience with Jupyter Labs, microservices, and deploying them on the web. By the end of this book, you will have taken your knowledge of Jupyter to the next level to perform all key tasks associated with it.
Table of Contents (17 chapters)
Title Page
Copyright and Credits
Packt Upsell
Contributors
Preface
Index

Using ipyleaflet widgets


ipyleaflet is described as a bridge for producing interactive maps in a Jupyter Notebook. This means we can put a map into a Notebook and allow the user to scroll around to a different point of view with this widget.

The documentation on the maps used is sparse. I have found a reasonable example in the following points. Finally, looking at the source code for the widget on GitHub, there are a few dozen maps visible that the widget knows about and which can be pulled in.

Getting ready

We can install the widget using a conda command:

conda install -c conda-forge ipyleaflet

ipyleaflets can be installed with pip as well.

Once completed, we can reference ipyleaflet in a Notebook.

How to do it...

We are using a detailed worldwide street map from Esri. The Notebook statements are:

from ipyleaflet import *
m = Map(zoom=4, basemap=basemaps.Esri.WorldStreetMap)
m
m.zoom

This generates the first image of the west coast of Africa. I navigated to the streets of Boston for the shot.

How...