Use ArcPy in a notebook
With the ArcPy site package, you can perform geographic data analysis, conversion, and management. ArcPy allows you to programmatically run all ArcGIS standard geoprocessing tools and provides helper functions and classes.
ArcPy is available in ArcGIS Notebooks through the Advanced notebook runtime. To use ArcPy in a notebook, ArcGIS Notebooks must be licensed with the Advanced license, and users must have the privilege to create and run ArcPy notebooks.
To learn more about how to prepare the workspace environments for ArcPy, see Manage content in the user workspace and Upload datasets to use with ArcPy.
Get started with ArcPy in a notebook
To use ArcPy in a notebook, import its library by running a cell with the following lines:
import arcpy
arcpy.GetInstallInfo()['Version']
To access or share content in your organization, you must be signed in. In ArcGIS Notebooks, you can sign in to your organization without explicitly providing a URL, username, or password by using the following code:
arcpy.SignInToPortal("notebook")
View the sample notebooks that are included with ArcGIS Notebooks to learn how ArcPy can be used in your notebooks.
ArcPy modules
The modules below are included with ArcPy in ArcGIS Notebooks.
The Data Access module,
arcpy.daallows control of the edit session, edit operation, improved cursor support (including faster performance), functions for converting tables and feature classes to and from NumPy arrays, and support for versioning, replicas, domains, and subtypes workflows.The Geocoding module,
arcpy.geocoding, allows you to perform various geocoding operations, including finding the location of a place or address, finding the closest place or address to a given location, or generating a set of autocomplete suggestions for partial input.The Image Analysis module,
arcpy.ia, allows you to manage and process imagery and raster data. The module also includes geoprocessing and raster processing automation functionality provided by the ArcGIS Image Analyst extension.The Mapping module,
arcpy.mp, allows you to manipulate the contents of existing projects (.aprx) and layer files (.lyrx) and to create and modify maps, layouts, and reports.The Metadata module,
arcpy.metadata, allows you to explore information describing your maps and data and automate your workflows, particularly for managing standards-compliant geospatial metadata.The Network Analyst module,
arcpy.nax, allows you to work with network analysis functionality provided with the ArcGIS Network Analyst extension.The legacy module
arcpy.nais not included with ArcGIS Notebooks.The Sharing module,
arcpy.sharingmodule allows you to automate sharing workflows. Use it to create a sharing draft, which is a configurable set of properties for a web layer, web tool and geoprocessing service, map service, or image service.The Spatial Analyst module,
arcpy.sa, provides access to all the geoprocessing tools available in the Spatial Analyst toolbox as well as other functions and classes that allow you to automate your raster processing workflows.
ArcPy functions
ArcPy provides a number of functions to better support workflows using Python. In addition to the function groups listed in this topic, all geoprocessing tools can be accessed as ArcPy functions.
For more information on the functions included in each group, see An overview of ArcPy functions in the ArcGIS Pro documentation.
The following groups of function are included with ArcGIS Notebooks:
ArcGIS Online / Portal functions
Data store functions
Describing data functions
Environment functions
Field functions
General functions, except
ListPrinterNamesGeneral data functions
Geometry functions
Licensing and installation functions
Listing data functions, except
ListVersionsLogging functions
Packaging functions
Progress dialog functions
Raster functions
Spatial reference and transformation functions