0 / 0
Quick start: Analyze data in a Jupyter notebook

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. Open your sandbox 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:

  • The data
  • The code computations that process the data
  • Visualizations of the results
  • Text and rich media to enhance understanding

Read more about notebooks

Watch a video about notebooks

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

This video provides a visual method to learn the concepts and tasks in this documentation.


Try a tutorial to create a notebook

In this tutorial, you will complete these tasks:

This tutorial will take approximately 15 minutes to complete.





Tips for completing this tutorial

Here are some tips for successfully completing this tutorial.

Use the video picture-in-picture

Tip: Start the video, then as you scroll through the tutorial, the video moves to picture-in-picture mode. Close the video table of contents for the best experience with picture-in-picture. You can use picture-in-picture mode so you can follow the video as you complete the tasks in this tutorial. Click the timestamps for each task to follow along.

The following animated image shows how to use the video picture-in-picture and table of contents features:

How to use picture-in-picture and chapters

Get help in the community

If you need help with this tutorial, you can ask a question or find an answer in the watsonx Community discussion forum.

Set up your browser windows

For the optimal experience completing this tutorial, open Cloud Pak for Data in one browser window, and keep this tutorial page open in another browser window to switch easily between the two applications. Consider arranging the two browser windows side-by-side to make it easier to follow along.

Side-by-side tutorial and UI

Tip: If you encounter a guided tour while completing this tutorial in the user interface, click Maybe later.



Task 1: Open a project

You need a project to store the notebook and data asset. You can use your sandbox project or create a project. Follow these steps to open a project and add a data asset to the project:

  1. From the navigation menu Navigation menu, choose Projects > View all projects

  2. Open your sandbox project. If you want to use a new project:

    1. Click New project.

    2. Select Create an empty project.

    3. Enter a name and optional description for the project.

    4. Choose an existing object storage service instance or create a new one.

    5. Click Create.

  3. From the navigation menu, click Resource hub.

  4. Search for an interesting data set, and select the data set.

  5. Click Add to project.

  6. Select the project from the list, and click Add.

  7. After the data set is added, click View Project.

  8. In the project, click the Assets tab to see the data set.

For more information, see Creating a project.

Checkpoint icon Check your progress

The following image shows the Assets tab in the project.

The following image shows the Assets tab in the project.




Task 2: Add a notebook to your project

preview tutorial video To preview this task, watch the video beginning at 00:06.

Follow these steps to create a new notebook in your project.

  1. In your project, on the Assets tab, click New asset > Work with data and models in Python or R notebooks.

  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.

Checkpoint icon Check your progress

The following image shows blank notebook.

The following image shows the blank notebook.




Task 3: Load a file and save the notebook

preview tutorial video To preview this task, watch the video beginning at 00:23.

Now you can access the data asset in your notebook that you uploaded to your project earlier. Follow these steps to load data into a data frame:

  1. Click in an empty code cell in your notebook.

  2. Click the Code snippets icon (Code snippets).

  3. In the side pane, click Read data.

  4. Click Select data from project.

  5. Locate the data asset from the project, and click Select.

  6. In the Load as drop-down list, select the load option that you prefer.

  7. Click Insert code to cell. The code to read and load the data asset is inserted into the cell.

  8. Click Run to run your code. The first few rows of your data set will display.

  9. To save a version of your notebook, click File > Save Version. You can also just save your notebook with File > Save.

Checkpoint icon Check your progress

The following image shows the notebook with the pandas DataFrame.

The following image shows the notebook with the pandas DataFrame.




Task 4: Find and edit the notebook

preview tutorial video To preview this task, watch the video beginning at 01:19.

Follow these steps to locate the saved notebook on the Assets tab, and edit the notebook:

  1. In the project navigation trail, click your project name to return to your project.

  2. Click the Assets tab to find the notebook.

  3. When you click the notebook, it will open in READ ONLY mode.

  4. To edit the notebook, click the pencil icon Pencil.

  5. Click the Information icon Information to open the Information panel.

  6. On the General tab, edit the name and description of the notebook.

  7. Click the Environment tab to see how you can change the environment used to run the notebook or update the runtime status to either stop and restart.

Checkpoint icon Check your progress

The following image shows the notebook with the Information panel displayed.

The following image shows the notebook with the Information panel displayed.




Task 5: Share read-only version of the notebook

preview tutorial video To preview this task, watch the video beginning at 01:52.

Follow these steps to create a link to the notebook to share with colleagues:

  1. Click the Share icon Share 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 the Copy icon Copy to copy a direct link to this notebook.

  5. Click Close.

Checkpoint icon Check your progress

The following image shows the Share dialog box.

The following image shows the Share dialog box.




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

preview tutorial video To preview this task, watch the video beginning at 02:08.

Follow these steps to create a job to schedule the notebook to run at a specific time or repeat based on a schedule:

  1. Click the Jobs icon, and select Create a job.
    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.

Checkpoint icon Check your progress

The following image shows the Jobs tab.

The following image shows the Jobs tab.



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

  • View more videos.

  • Find sample data sets, projects, models, prompts, and notebooks in the Resource hub to gain hands-on experience:

    Notebook Notebooks that you can add to your project to get started analyzing data and building models.

    Project Projects that you can import containing notebooks, data sets, prompts, and other assets.

    Data set Data sets that you can add to your project to refine, analyze, and build models.

    Prompt Prompts that you can use in the Prompt Lab to prompt a foundation model.

    Model Foundation models that you can use in the Prompt Lab.

Parent topic: Quick start tutorials

Generative AI search and answer
These answers are generated by a large language model in watsonx.ai based on content from the product documentation. Learn more