Notebooks and scripts (Watson Studio)

You can create, edit and execute Python and R code using Jupyter notebooks and scripts in code editors, for example the notebook editor or an integrated development environment (IDE), like RStudio.

Notebooks
A Jupyter notebook is a web-based environment for interactive computing. You can use notebooks to 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 that you need to work with data, namely the data, the code computations that process the data, the visualizations of the results, and text and rich media to enhance understanding.
Scripts
A script is a file that contains a set of commands and comments. The script can be saved and used later to re-execute the saved commands. Unlike in a notebook, the commands in a script can only be executed in a linear fashion.

Notebooks

Required service
Watson Studio

Service The Watson Studio service is not available by default. An administrator must install this services on the IBM Cloud Pak for Data platform. To determine whether the service is installed, open the Services catalog and check whether the service is enabled.

Required permissions
Editor or Admin role in a project
Tools
Notebook editor
JupyterLab
Visual Studio Code
Programming languages
Notebook editor: Python and R
JupyterLab: Python
Visual Studio Code: Python
Data format
All types
Code support is available for loading and accessing data from project assets for:
Data assets, such as CSV, JSON and .xlsx and .xls files
Database connections and connected data assets

See Data load support for the supported file and database types.

Data size
5 GB. If your files are larger, you must load the data in multiple parts.

Scripts

Required services
Watson Studio
RStudio Server with R 4.2

Service These services are not available by default. An administrator must install the services on the IBM Cloud Pak for Data platform. To determine whether the services are installed, open the Services catalog and check whether the services are enabled.

Required permissions
Editor or Admin role in a project
Tools
JupyterLab
Visual Studio Code
RStudio
Programming languages
JupyterLab: Python
Visual Studio Code: Python
RStudio: R
Data format
All types
Code support is available for loading and accessing data from project assets for:
Data assets, such as CSV, JSON and .xlsx and .xls files
Database connections and connected data assets

See Data load support for the supported file and database types.

Data size
5 GB. If your files are larger, you must load the data in multiple parts.

Working in the notebook editor

The notebook editor is largely used for interactive, exploratory data analysis programming and data visualization. Only one person can edit a notebook at a time. All other users can access opened notebooks in view mode only, while they are locked.

You can use these types of libraries:

  • Preinstalled open source libraries that come with the notebook runtime environments
  • IBM libraries provided at no extra cost that come with the notebook runtime environments
  • Your own libraries

When your notebooks are ready, you can create jobs to run the notebooks directly from the notebook editor. Your job configurations can use environment variables that are passed to the notebooks with different values when the notebooks run.

Working in RStudio

RStudio is an integrated development environment for working with R scripts or Shiny apps. Although the RStudio IDE cannot be started in a Spark with R environment runtime, you can use Spark in your R scripts and Shiny apps by accessing Spark kernels programmatically.

To enhance collaboration and support file sharing, consider setting up a project with Git integration.

Working in JupyterLab

JupyterLab offers an IDE-like development interface which includes notebooks. The modular structure of the interface is extensible and open to developers, allowing working with several open notebooks or files in tabs in the same window.

To work in JupyterLab, you must associate the project with a Git repository and select to edit notebooks with the JuypterLab IDE. The integration with GIT supports collaboration and file sharing.

Working in Visual Studio Code

The Watson Studio extension for Visual Studio Code allows you to connect to your Cloud Pak for Data cluster directly from your VS Code editor. You can launch and stop your runtimes directly from VS Code, securely connect to your runtimes on a Cloud Pak for Data cluster through SSH, and edit the files inside your Watson Studio Git-based project through SSH.

To work with the Watson Studio extension for Visual Studio Code, you must associate the project with a Git repository. The integration with GIT supports collaboration and file sharing.

Learn more

Parent topic: Analyzing data and building models