Quick start: Analyze data in a Jupyter notebook

You can create a notebook in which you run code to prepare, visualize, and analyze data, or build and train a model. Read about Jupyter notebooks, then watch a video and take a tutorial that’s suitable for users with some knowledge of Python code.

Your basic workflow includes these tasks:

  1. Create a project. Projects are where you can collaborate with others to work with data.
  2. Add your data to the project. You can add CSV files or data from a remote data source through a connection.
  3. Create a notebook in the project.
  4. Add code to the notebook to load and analyze your data.
  5. Run your notebook and share the results with your colleagues.

Read about notebooks

A Jupyter notebook is a web-based environment for interactive computing. You can run small pieces of code that process your data, and you can immediately view the results of your computation. Notebooks include all of the building blocks you need to work with data:

Read more about notebooks

Watch a video about notebooks

Watch Video Watch this video to learn the basics of Jupyter notebooks.

Video disclaimer: Some minor steps and graphical elements in this video differ from your Cloud Pak for Data deployment. This video shows the Cloud Pak for Data as a Service user interface.

This video provides a visual method as an alternative to following the written steps in this documentation.

Try a tutorial to create a notebook

In this tutorial, you will complete these tasks:

  1. Create a project.
  2. Add a notebook to your project.
  3. Load a file and save the notebook.
  4. Find and edit the notebook.
  5. Share read-only version of the notebook.
  6. Schedule a notebook to run at a different time.

This tutorial will take approximately 15 minutes to complete.

Task 1: Create a project and add an asset

You need a project to store the notebook and data asset.

  1. If you have an existing project, open it. If you don't have an existing project, click Create a project on the home page or click New project on your Projects page.
  2. Select Analytics project as the project type.
  3. Select Create an empty project.
  4. On the Create a project screen, add a name and optional description for the project.
  5. Click Create.
  6. Download the precipitation.csv file
  7. Add the precipitation.csv file to your project:
    1. From your project, click Add to project > Data.
    2. In the Load pane that opens, browse to select the precipitation.csv file, and click Open. Stay on the page until the load completes. The precipitation.csv file is added to your project as a data asset.

For more information or to watch a video, see Creating a project.

Task 2: Add a notebook to your project

Create a new notebook in your project.

  1. From your project's Assets page, click Add to project > Notebook.
  2. Type a name and description (optional).
  3. Select a runtime environment for this notebook.
  4. Click Create. Wait for the notebook editor to load.

Task 3: Load a file and save the notebook

Load data into a pandas DataFrame.

  1. Click the Find and add data icon.
  2. From the Files tab, click the Insert to code dropdown next to the data set you added, and insert the pandas DataFrame.
  3. Click Run to run your code. The first few rows of your data set will display.
  4. To save a version of your notebook, click File > Save Version. You can also just save your notebook with File > Save.

Task 4: Find and edit the notebook

Locate the saved notebook on the Assets tab, and edit the notebook.

  1. Return to your project to find your notebook on the Assets tab.
  2. When you click the notebook, it will open in READ ONLY mode.
  3. To edit the notebook, click the pencil icon.
  4. Access the Info panel.
  5. On the General tab, edit the name and description of the notebook.
  6. Click the Environment tab to see where you can change the environment used to run the notebook or update the runtime status to either stop and restart.

Task 5: Share read-only version of the notebook

Create a link to the notebook to share with colleagues.

  1. Click the Share icon if you would like to share the read-only view of the notebook.
  2. Click to turn on the Share with anyone who has the link toggle button.
  3. Select what content you would like to share through a link or social media.
  4. Click Close.

Task 6: Schedule a notebook to run at a different time

Create a job to schedule the notebook to run at a specific time or repeat based on a schedule.

  1. Click the job icon, and select Create a job.
  2. Provide the name and description of the job, and click Next.
  3. Select the notebook version and environment runtime, and click Next.
  4. (Optional) Click the toggle button to schedule a run. Specify the date, time and if you would like the job to repeat, and click Next.
  5. (Optional) click the toggle button to receive notifications for this job, and click Next.
  6. Review the details, and click either Create (to create the job, but not run the job immediately) or Create and run (to run the job immediately).
  7. The job will display in the Jobs tab in the project.

Next steps

Now you can use this data set for further analysis. For example, you or other users can do any of these tasks:

Additional resources