Notebooks in ArcGIS Pro

ArcGIS Notebooks are built on top of JupyterLab, an open-source web application that allows you to create and share documents, called notebooks, that contain live Python code, visualizations, and narrative text. With ArcGIS Notebooks integrated into ArcGIS Pro, you can perform analysis and immediately view results in a geographic context, interact with the emerging data, document and automate your workflow, and save it for later use or share it. ArcGIS Notebooks uses include data cleaning and transformation, numerical simulation, statistical modeling, machine learning, administrative tasks, and more.

All Python functionality in ArcGIS Pro is available through ArcGIS Notebooks, including core Python functionality, the Python standard library, ArcPy, ArcGIS API for Python, and the numerous third-party libraries included with ArcGIS Pro such as NumPy and pandas. ArcGIS Pro can be extended with open-source libraries using the ArcGIS Pro Package Manager.

While open-source Jupyter Notebooks are run locally in the ArcGIS Pro application, Esri's integrated Jupyter Notebook experience is also available in ArcGIS Online or an ArcGIS Enterprise portal.

If you are looking for an interactive Python terminal to test or run short snippets of code without advanced notebook capabilities, see Python window.

How to use ArcGIS Notebooks in ArcGIS Pro

To create a notebook, click the Insert tab on the ribbon, and click the New Notebook button New Notebook. Alternatively, open the Catalog pane, browse to your project directory, right-click a folder, and select New > Notebook New Notebook.

ArcGIS Notebooks that have been added to a project are listed under the Notebooks folder Notebooks in the Catalog pane. Notebooks that are created using ArcGIS Pro are automatically added to your project. To add an existing notebook to the project, right-click the Notebooks folder and choose Add Notebook Add Notebook, or alternatively, click the drop-down arrow next to the Add Notebook button on the Insert ribbon and select Add Notebook.

To open an existing notebook in your project, browse to the notebook file in the Catalog pane and either double-click the notebook, or right-click the notebook and select Open Notebook.

A notebook opens in a user interface that resembles a Jupyter Notebook. Some options including the New New Notebook and Save Save buttons are found on the Notebook ribbon. The Notebook ribbon is available when a Notebook view is open and selected. See the Jupyter Notebook user interface documentation for more information on how to use Jupyter Notebooks.

Use the Export drop-down menu Script to export a notebook to a Python (.py) or HTML (.html) file. To interrupt a cell that is running, click the Interrupt Kernel button Cancel.

Additional help

The tab completion feature provides contextual help based on the location of the pointer. Methods and properties can be viewed by pressing Tab after the dot following the object or library name. For example, type arcpy.analysis into a cell and press Tab to display a list of possible methods available from the analysis module. Once the list is displayed, you can filter it further by typing related words. After selecting a suitable method from the list, press Enter to use it.

Use the tab completion feature to access choices in an ArcGIS Notebook.

Python tools, modules, functions, classes, and keywords all store documentation that provides information on their use. Activate the documentation at the pointer by pressing Shift+Tab. The following is the documentation displayed for the Buffer tool:

Press Shift+Tab to access help for a tool.

Alternatively, the same documentation can be accessed using the built-in Python help function. The following is the help documentation displayed for arcpy.analysis.Buffer:

Use the Python help function to access a tool's help documentation.

Integration with ArcGIS Pro

In addition to the Python window, ArcGIS Notebooks in ArcGIS Pro provide access to content in your map, allowing for interactive workflows such as the following:

  • Layers and other contents of your map can be accessed in your notebook by name or using a path to the data.
  • The output of geoprocessing tools is added to the active map by default.
  • Geoprocessing tools honor selections.
  • Global geoprocessing environment settings are respected and can be overridden by environment settings.
  • Geoprocessing workflows can occur during an ongoing editing session. If a geoprocessing tool directly modifies a feature being edited in an edit session (it does not save the result of geoprocessing as another feature class), you can save or discard the modifications from the Edit ribbon.
  • When a geoprocessing tool is run from an ArcGIS Notebook, the tool's result log appears in the geoprocessing history.
Caution:

ArcGIS Pro is designed to run a single Python instance. This Python instance is shared by each open notebook in a single instance of ArcGIS Pro. If different notebooks use the same variable name, variable name collisions could result. To avoid potential variable name collisions, consider the following options:

  1. Open one notebook at a time.
  2. Run notebooks in separate instances of ArcGIS Pro.
  3. Use unique variable names in concurrently running notebooks.
  4. Run the %reset -f magic command to delete all variables in a notebook.

Caution:

ArcGIS Notebooks hosted with ArcGIS Enterprise are not supported directly in ArcGIS Pro. To use a hosted notebook in ArcGIS Pro, download and use the .ipynb file locally.

ArcGIS Notebooks in ArcGIS Pro only support Python; no other language kernels (such as R) are supported.

ArcGIS API for Python

In ArcGIS API for Python, the GIS object is used to represent the GIS you are working with, such as ArcGIS Online or an instance of ArcGIS Enterprise. Your GIS can support a number of authentication schemes; see Working with different authentication schemes to learn how to authenticate your scripts and notebooks for different schemes.

For example, to connect to ArcGIS Online as an anonymous user, specify gis = GIS(). To connect to your active portal in ArcGIS Pro without entering credentials, specify gis = GIS("home").