This guide was created by the staff of the GIS/Data Center at Rice University and is to be used for individual educational purposes only.

The steps outlined in this guide require access to ArcGIS Pro software and data that is available both online and at Fondren Library.

The following text styles are used throughout the guide:

Explanatory text appears in a regular font.

  1. Instruction text is numbered.
  2. Required actions are underlined.
  3. Objects of the actions are in bold.

Folder and file names are in italics.

Names of Programs, Windows, Panes, Views, or Buttons are Capitalized.

'Names of windows or entry fields are in single quotation marks.'

"Text to be typed appears in double quotation marks."

The following step-by-step instructions and screenshots are based on the Windows 10 operating system with the Windows Classic desktop theme and ArcGIS Pro 3.0.0 software. If your personal system configuration varies, you may experience minor differences from the instructions and screenshots. Some of the features covered in this tutorial may not be available if using an older version of ArcGIS Pro.

Dataset for this course

Python Crash Course

What is Python?

Python is a high-level scripting programming language often used for data analysis, among numerous other applications. In ArcGIS Pro, Python is used to define many of the tools in the background, and can also be utilized by the user to automate part or all of a data analysis project in ArcGIS Pro.  This automation is done by writing Python scripts, which are instructions written by the programmer for Python to carry out. 

Setting Up a Python Script in ArcGIS Pro

The easiest (and most convenient) way to write Python scripts in ArcGIS Pro is to use notebooks in ArcGIS Pro. We will first set up a notebook in ArcGIS Pro to go over some Python basics, and learn more about notebooks later on. 

(setup notebook)

Python Data Types

The building blocks of a program are variables, which store data in a variety of forms. This data can be made available to the programmer and used later in the program in multiple ways.


First, let's work with numbers in Python. By typing the code shown below, we can store the number 3 in variable a, and the number 4 in variable b.

We can check the values of these variables by using the print function as shown below.

Click the "Run" button to run the code in the current cell as indicated below.

After running this cell, we can see the values 3 and 4 appear just below the cell that has been run. 

Now, we can run some basic arithmetic operations with these numbers. The operations shown below correspond to addition, subtraction, multiplication, and division, respectively. After printing each of the corresponding variables, we can see the results. 

We can treat decimal numbers in a very similar way, and combine them with integers. 


Before we start looking at our next data type (Booleans), we can start a new cell to separate our previous code with our new code. To do this, press the "+" button in the Notebook menu. 

Boolean variables are the simplest type of variables- any Boolean is either True or False. We can code them as such here:

We can combine them using keywords "and" and "or". If two Boolean variables i and j are both True, then "i and j" results in True. In any other case, "i and j" results in False. 

If either of the two Boolean variables i and are True, then "i or j" results in True. If both i and j are False, then "i or j" results in False. 


Python lists store multiple other Python variables inside one variable- simply put, they are simply lists of variables. It is recommended, though not enforced, that all of these variables are the same type.


Strings in Python are simply lists of characters, which are letters, numbers, or other symbols enclosed in quotes. 


Dictionaries in Python 


Conditional Statements


Using Python in ArcGIS

Field Calculations

Fields in ArcGIS Pro

Why Use Python?

Switching Data Types

Defining a Field from Other Fields


Jupyter Notebooks

Jupyter Notebooks in ArcGIS Pro

Automating Workflow Using Jupyter Notebooks

Here, we'll go through a short sample project to practice using some simple tools using Python in ArcGIS Pro notebooks.

Our goal for this project will be to take a collection of schools throughout the United States, and create a layer containing the average center of these schools for each state / territory. The approach we'll take isn't necessarily the most efficient way of doing this, but will allow us to look at a wide variety of ways to use Python in ArcGIS Pro. 

The collection of schools we'll be working with can be found at O:\GDCTraining\1_Short_Courses\Python_and_ArcGIS\StateSchools.gdb\PublicSchools10K. The layer of US states / territories can be found at O:\GDCTraining\1_Short_Courses\Python_and_ArcGIS\StateSchools.gdb\USStates. The original source of the schools is from (, which was reduced to a collection of 10,000 schools for the sake of time, as these tools can take a long time to run, regardless of whether or not Python is being used. Alternatively, these datasets can be downloaded from this file


  • No labels