O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Jupyter Cookbook

Book Description

Leverage the power of the popular Jupyter notebooks to simplify your data science tasks without any hassle

About This Book
  • Create and share interactive documents with live code, text and visualizations
  • Integrate popular programming languages such as Python, R, Julia, Scala with Jupyter
  • Develop your widgets and interactive dashboards with these innovative recipes
Who This Book Is For

This cookbook is for data science professionals, developers, technical data analysts, and programmers who want to execute technical coding, visualize output, and do scientific computing in one tool. Prior understanding of data science concepts will be helpful, but not mandatory, to use this book.

What You Will Learn
  • Install Jupyter and configure engines for Python, R, Scala and more
  • Access and retrieve data on Jupyter Notebooks
  • Create interactive visualizations and dashboards for different scenarios
  • Convert and share your dynamic codes using HTML, JavaScript, Docker, and more
  • Create custom user data interactions using various Jupyter widgets
  • Manage user authentication and file permissions
  • Interact with Big Data to perform numerical computing and statistical modeling
  • Get familiar with Jupyter's next-gen user interface - JupyterLab
In Detail

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.

Style and approach

The recipes in this book are highly practical and very easy to follow, and include tips and tricks that will help you crack any problem that you might come across while getting the most out of your Jupyter notebook.

Downloading the example code for this book You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Table of Contents

  1. Title Page
  2. Copyright and Credits
    1. Jupyter Cookbook
  3. Packt Upsell
    1. Why subscribe?
    2. PacktPub.com
  4. Contributors
    1. About the author
    2. About the reviewers
    3. Packt is searching for authors like you
  5. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Download the color images
      3. Conventions used
    4. Get in touch
      1. Reviews
  6. Installation and Setting up the Environment
    1. Introduction
    2. Installing Jupyter on Windows
      1. Getting ready
      2. How to do it...
        1. Installing Jupyter directly
        2. Installing Jupyter through Anaconda
    3. Installing Jupyter on the Mac
      1. Getting ready
      2. How to do it...
        1. Installing Jupyter on the Mac via Anaconda
        2. Installing Jupyter on the the Mac via the command line
    4. Installing Jupyter on Linux
      1. How to do it...
    5. Installing Jupyter on a server
      1. How to do it...
        1. Example Notebook with a user data collision
  7. Adding an Engine
    1. Introduction
    2. Adding the Python 3 engine
      1. How to do it...
        1. Installing the Python 3 engine
        2. Running a Python 3 script
    3. Adding the R engine
      1. How to do it...
        1. Installing the R engine using Anaconda Navigator
        2. Installing the R engine via command line
        3. Running an R Script
    4. Adding the Julia engine
      1. How to do it...
        1. Installing the Julia engine
        2. Running a Julia script
    5. Adding the JavaScript engine
      1. How to do it...
        1. Installing the Node.JS engine
        2. Running a Node.JS script
    6. Adding the Scala engine
      1. How to do it...
        1. Installing the Scala engine
        2. Running a Scala script
    7. Adding the Spark engine
      1. How to do it...
        1. Installing the Spark engine
        2. Running a Spark script
  8. Accessing and Retrieving Data
    1. Introduction
    2. Reading CSV files
      1. Getting ready
      2. How to do it...
      3. How it works...
    3. Reading JSON files
      1. Getting ready
      2. How to do it...
      3. How it works...
    4. Accessing a database
      1. Getting ready
      2. How to do it...
      3. How it works...
    5. Reading flat files
      1. Getting ready
      2. How to do it...
      3. How it works...
    6. Reading text files
      1. Getting ready
      2. How to do it...
      3. How it works...
  9. Visualizing Your Analytics
    1. Introduction
    2. Generating a line graph using Python
      1. How to do it...
      2. How it works...
    3. Generating a histogram using Python
      1. How to do it...
      2. How it works...
    4. Generating a density map using Python
      1. How to do it...
      2. How it works...
    5. Plotting 3D data using Python
      1. How to do it...
      2. How it works...
    6. Present a user-interactive graphic using Python
      1. How to do it...
      2. How it works...
    7. Visualizing with R
      1. How to do it...
      2. How it works...
    8. Generate a regression line of data using R
      1. How to do it...
      2. How it works...
    9. Generate an R lowess line graph
      1. How to do it...
      2. How it works...
    10. Producing a Scatter plot matrix using R
      1. How to do it...
      2. How it works...
    11. Producing a bar chart using R
      1. How to do it...
      2. How it works...
    12. Producing a word cloud using R
      1. How to do it...
      2. How it works...
    13. Visualizing with Julia
      1. Getting ready
      2. How to do it...
    14. Drawing a Julia scatter diagram of Iris data using Gadfly
      1. How to do it...
    15. Drawing a Julia histogram using Gadfly
      1. How to do it...
      2. How it works...
    16. Drawing a Julia line graph using the Winston package
      1. How to do it...
      2. How it works...
  10. Working with Widgets
    1. Introduction
    2. What are widgets?
      1. Getting ready
      2. How to do it...
      3. How it works...
    3. Using ipyleaflet widgets
      1. Getting ready
      2. How to do it...
      3. How it works...
    4. Using ipywidgets
      1. Getting ready
      2. How to do it...
      3. How it works...
    5. Using a widget container
      1. How to do it...
    6. Using an interactive widget
      1. How to do it...
      2. How it works...
    7. Using an interactive text widget
      1. How to do it...
      2. How it works...
    8. Linking widgets together
      1. How to do it...
      2. How it works...
    9. Another ipywidgets linking example
      1. How to do it...
      2. How it works...
    10. Using a cookie cutter widget
      1. Getting ready
      2. How to do it...
      3. How it works...
    11. Developing an OPENGL widget
      1. Getting ready
    12. Creating a simple orbit of one object
      1. How to do it...
      2. How it works...
    13. Using a complex orbit of multiple objects
      1. How to do it...
      2. How it works...
  11. Jupyter Dashboards
    1. Introduction
    2. What is Jupyter dashboards?
      1. Getting ready
      2. How to do it...
      3. There's more...
    3. Creating an R dashboard
      1. How to do it...
      2. How it works...
    4. Create a Python dashboard
      1. How to do it...
    5. Creating a Julia dashboard
      1. How to do it...
    6. Develop a JavaScript (Node.js) dashboard
      1. How to do it...
  12. Sharing Your Code
    1. Introduction
      1. Sharing your Notebook using server software
    2. Using a Notebook server
      1. How to do it...
        1. Using web encryption for your Notebook
    3. Using a web server
      1. How to do it...
    4. Sharing your Notebook through a public server
      1. How to do it...
    5. Sharing your Notebook through Docker
      1. How to do it...
    6. Sharing your Notebook using nbviewer
      1. How to do it...
    7. Converting your Notebook into a different format
      1. How to do it...
    8. Converting Notebooks to R
      1. How to do it...
      2. How it works...
    9. Converting Notebooks to HTML
      1. How to do it...
      2. How it works...
    10. Converting Notebooks to Markdown
      1. How to do it...
      2. How it works...
    11. Converting Notebooks to reStructedText
      1. How to do it...
      2. How it works...
    12. Converting Notebooks to Latex
      1. How to do it...
      2. How it works...
    13. Converting Notebooks to PDF
      1. How to do it...
      2. How it works...
  13. Multiuser Jupyter
    1. Introduction
    2. Why multiuser?
      1. How to do it...
      2. How it works...
    3. Providing multiuser with JupyterHub
      1. Getting ready
      2. How to do it...
    4. Providing multiuser with Docker
      1. Getting ready
      2. How to do it...
    5. Running your Notebook in Google Cloud Platform
      1. Getting ready
        1. Set up your GC project
        2. Create a Cloud storage bucket
        3. Create a cluster
        4. Install Jupyter
          1. Download the script
          2. Execute the script
          3. Configure Jupyter
      2. How to do it...
        1. Next steps
      3. There's more...
    6. Running your Notebook in AWS
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
    7. Running your Notebook in Azure
      1. Getting ready
      2. How to do it...
      3. How it works...
      4. There's more...
  14. Interacting with Big Data
    1. Introduction
    2. Obtaining a word count from a big-text data source
      1. How to do it...
      2. How it works...
    3. Obtaining a sorted word count from a big-text source
      1. How to do it...
      2. How it works...
    4. Examining big-text log file access
      1. How to do it...
      2. How it works...
    5. Computing prime numbers using parallel operations
      1. How to do it...
      2. How it works...
    6. Analyzing big-text data
      1. How to do it...
      2. How it works...
    7. Analyzing big data history files
      1. How to do it...
      2. How it works...
  15. Jupyter Security
    1. Introduction
      1. How much risk?
      2. Known vulnerabilities
      3. Web attack strategies
      4. Inherent Jupyter security issues
    2. Security mechanisms built into Jupyter
      1. How to do it...
        1. Token-based authentication
        2. Password authentication
        3. No authentication
    3. Using SSL
      1. How to do it...
        1. Creating an SSL certificate
        2. Apply the SSL certificate
    4. The Jupyter trust model
      1. How to do it...
        1. Trust overrides
        2. Collaboration
    5. Controlling network access
      1. How to do it...
        1. Controlling domain access
        2. Controlling IP access
    6. Additional practices
      1. How to do it...
        1. Server IP address
        2. URL prefix
        3. No browser
  16. Jupyter Labs
    1. Introduction
      1. JupyterLab features
    2. Installing and starting JupyterLab
      1. How to do it...
        1. Installing JupyterLab
        2. Starting JupyterLab
    3. JupyterLab display
      1. How to do it...
    4. JupyterLab menus
      1. How to do it...
    5. Starting a Notebook
      1. How to do it...
    6. Starting a console