{"id":453682,"date":"2019-03-26T09:46:43","date_gmt":"2019-03-26T16:46:43","guid":{"rendered":"http:\/\/www.esri.com\/arcgis-blog\/?post_type=blog&#038;p=453682"},"modified":"2019-07-31T16:30:16","modified_gmt":"2019-07-31T23:30:16","slug":"beginners-guide-to-python-in-arcgis-pro-part-4-tutorial-cont","status":"publish","type":"blog","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/beginners-guide-to-python-in-arcgis-pro-part-4-tutorial-cont","title":{"rendered":"Beginner&#8217;s guide to Python in ArcGIS Pro, Part 4: Tutorial cont."},"author":8112,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","format":"standard","meta":{"_acf_changed":false,"_searchwp_excluded":""},"categories":[23341],"tags":[31181,359062,122232,24341,27911],"industry":[],"product":[36561],"class_list":["post-453682","blog","type-blog","status-publish","format-standard","hentry","category-analytics","tag-arcpy","tag-ide","tag-learn","tag-python","tag-tutorial","product-arcgis-pro"],"acf":{"short_description":"A quick hands-on introduction to standalone geoprocessing scripts for the non-programmer.","flexible_content":[{"acf_fc_layout":"content","content":"<p>This ArcGIS Pro Python tutorial is the fourth installment in a series introducing Python in ArcGIS Pro. It assumes you\u2019re a comfortable GIS user, but have no programming experience. Start at the <a href=\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/uncategorized\/beginners-guide-to-python-in-arcgis-pro-part-1-why\/\">first post in the series<\/a> to get the full introduction, or, if you\u2019re just here for the tutorial, see <a href=\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/uncategorized\/beginners-guide-to-python-in-arcgis-pro-part-3-tutorial\/\">post three<\/a>\u00a0to start at the beginning, and return here to finish.<\/p>\n"},{"acf_fc_layout":"image","image":{"ID":469712,"id":469712,"title":"lionsmall","filename":"lionsmall.png","filesize":30559,"url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/lionsmall.png","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/beginners-guide-to-python-in-arcgis-pro-part-4-tutorial-cont\/lionsmall","alt":"Lion","author":"8112","description":"","caption":"If you don\u2019t know what lions have to do with this, that\u2019s a sign that you haven\u2019t done the first part of the tutorial yet. Click the link in the paragraph above to do that.  (Photo courtesy Schuyler Shepherd via Wikimedia commons under CC BY-SA 2.5) ","name":"lionsmall","status":"inherit","uploaded_to":453682,"date":"2019-03-25 23:00:06","modified":"2019-03-25 23:01:50","menu_order":0,"mime_type":"image\/png","type":"image","subtype":"png","icon":"https:\/\/www.esri.com\/arcgis-blog\/wp-includes\/images\/media\/default.png","width":500,"height":334,"sizes":{"thumbnail":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/lionsmall-150x150.png","thumbnail-width":150,"thumbnail-height":150,"medium":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/lionsmall.png","medium-width":391,"medium-height":261,"medium_large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/lionsmall.png","medium_large-width":500,"medium_large-height":334,"large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/lionsmall.png","large-width":500,"large-height":334,"1536x1536":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/lionsmall.png","1536x1536-width":500,"1536x1536-height":334,"2048x2048":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/lionsmall.png","2048x2048-width":500,"2048x2048-height":334,"card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/lionsmall.png","card_image-width":500,"card_image-height":334,"wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/lionsmall.png","wide_image-width":500,"wide_image-height":334}},"image_position":"center","orientation":"horizontal","hyperlink":"https:\/\/commons.wikimedia.org\/wiki\/File:Serengeti_Lion_Running_saturated.jpg"},{"acf_fc_layout":"content","content":"<h1>Meet your IDE<\/h1>\n<p>As mentioned in the previous post, you\u2019ll likely use two different Python environments for your ArcGIS Pro work. The first is the Python window. This is a good place to test bits of code and see immediate results on a map. You can write entire scripts in the Python window, but you\u2019ll likely find this easier to do outside of ArcGIS Pro in an IDE.<\/p>\n<p>An IDE, or integrated development environment, is an application that provides an environment in which to write, debug, and run code. IDEs flag potential errors, allow you to run code one line at a time, and generally offer a more robust environment for creating scripts.<\/p>\n<p>In this part of the tutorial, you\u2019ll create a script in the PyCharm IDE to extract information from a feature class without opening it in Pro. Before you begin, download <a href=\"https:\/\/www.jetbrains.com\/pycharm\/download\/\">Pycharm. Choose the free Community version and follow the setup prompts. <\/a><\/p>\n<p>A Python 3 <strong>interpreter <\/strong>(a program that reads and executes Python code) was installed on your machine when you downloaded ArcGIS Pro, but in order to access it, you first need to point PyCharm to the location. You\u2019ll do that by configuring the interpreter settings.<\/p>\n"},{"acf_fc_layout":"sidebar","content":"<p>Note: There are a lot of IDEs to choose from, each with its own benefits. I chose PyCharm because it\u2019s the IDE used by two super useful Esri Training courses I think you should try. They are <a href=\"https:\/\/www.esri.com\/training\/catalog\/57630436851d31e02a43f13c\/python-for-everyone\/\" target=\"_blank\" rel=\"noopener\">Python for Everyone<\/a> (free), and <a href=\"https:\/\/www.esri.com\/training\/catalog\/5763042c851d31e02a43ed84\/python-scripting-for-geoprocessing-workflows\/\" target=\"_blank\" rel=\"noopener\">Python Scripting for Geoprocessing Workflows<\/a> (free if you\u2019re on maintenance).<\/p>\n","image_reference":false,"layout":"standard","image_reference_figure":"","snippet":"","spotlight_name":"","section_title":"","position":"Center","spotlight_image":false},{"acf_fc_layout":"content","content":"<ol>\n<li>Open PyCharm\u00a0(if it didn\u2019t open automatically after the download, go to the Windows Start menu. In your list of programs, looks for JetBrains PyCharm Community Edition). Several pop-up windows may appear. Accept default settings and agreements as necessary until you see the Welcome screen.<\/li>\n<li>Click Configure and then Settings (you can also access settings from the File menu within PyCharm).<\/li>\n<li>The Settings window will open to the Appearance tab. I&#8217;ve used the IntelliJ theme to capture screenshots for this blog; you can optionally change your theme here to match mine. Select the theme from the drop-down list and click Apply.<\/li>\n<li>Click Project Interpreter from the list at left.<\/li>\n<li>In the top-right corner of the page, click the gear-shaped Configure button and then Add.<\/li>\n<li>In the pop-up window, click the System Interpreter tab, and click Browse (\u2026) next to the default path.<\/li>\n<li>Navigate to <em>C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\envs\\arcgispro-py3<\/em> and choose <em>python.exe<\/em>. Click OK three times, or until you\u2019re back at the Welcome screen. It will take a few minutes for the interpreter to update.<\/li>\n<\/ol>\n<p>Now, back to where we left off in our story\u2026<\/p>\n"},{"acf_fc_layout":"content","content":"<p><strong>The species that roam our streets (rogue zoo animals, continued)<\/strong><\/p>\n<p>You\u2019re a GIS analyst for the city of Redlands, where it\u2019s been a hectic morning. Last night, a bunch of animals were released from the zoo, and today the authorities are scrambling to ensure public safety. You\u2019ve been working in ArcGIS Pro using the Python window to identify schools within 1 kilometer of reported animal sightings. Just as you\u2019re backing up your work to a Python file and brainstorming how you could refine your new script, there\u2019s a knock on your office door. Unfortunately, it\u2019s not the local press dropping by to ask you about how you\u2019ve harnessed the power of GIS to help save children from wild zoo animals. It\u2019s your boss, who wants you to work on something different now. Animal control is requesting a list of the species sighted by one of the field workers, Jimmy, who is not responding to calls.<\/p>\n<p>Since you just looked at the attribute table for Jimmy\u2019s field sightings in ArcGIS Pro, you know the three species of animals he saw, and you relay that information. \u2018But what if they come back later in the day and want information about another agent?\u2019 you wonder. \u2018Or if the next dataset Jimmy sends in is longer and hard to skim through visually?\u2019<\/p>\n<p>This calls for a script. This time, you\u2019ll do your work outside of ArcGIS Pro, in the PyCharm IDE. This way, you\u2019ll be able to edit it later with ease, and since the results you need will be text, it\u2019s not important to look at a map.<\/p>\n<ol>\n<li>Create a new folder for your zoo-related Python scripts in a convenient location, such as your C drive, and name it <em>PythonZoo<\/em>.<\/li>\n<li>Return to the PyCharm welcome screen, if it\u2019s still open, or open PyCharm again.<\/li>\n<li>Click Open (if you\u2019re on a window other than the Welcome screen, click File &gt; Open). Browse to and select your PythonZoo folder and click OK.<\/li>\n<\/ol>\n"},{"acf_fc_layout":"image","image":{"ID":469732,"id":469732,"title":"01","filename":"01.png","filesize":15447,"url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/01.png","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/beginners-guide-to-python-in-arcgis-pro-part-4-tutorial-cont\/attachment\/01","alt":"PyCharm Open window","author":"8112","description":"","caption":"If you can\u2019t find your new folder, click the Refresh icon on the top of the Open File or Project window. ","name":"01","status":"inherit","uploaded_to":453682,"date":"2019-03-25 23:05:56","modified":"2019-03-25 23:06:35","menu_order":0,"mime_type":"image\/png","type":"image","subtype":"png","icon":"https:\/\/www.esri.com\/arcgis-blog\/wp-includes\/images\/media\/default.png","width":400,"height":337,"sizes":{"thumbnail":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/01-150x150.png","thumbnail-width":150,"thumbnail-height":150,"medium":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/01.png","medium-width":310,"medium-height":261,"medium_large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/01.png","medium_large-width":400,"medium_large-height":337,"large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/01.png","large-width":400,"large-height":337,"1536x1536":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/01.png","1536x1536-width":400,"1536x1536-height":337,"2048x2048":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/01.png","2048x2048-width":400,"2048x2048-height":337,"card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/01.png","card_image-width":400,"card_image-height":337,"wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/01.png","wide_image-width":400,"wide_image-height":337}},"image_position":"center","orientation":"horizontal","hyperlink":""},{"acf_fc_layout":"content","content":"<p style=\"padding-left: 120px\">A\u00a0PythonZoo\u00a0project opens in PyCharm. Like ArcGIS Pro, PyCharm is a project-based work environment. When you open an empty folder, PyCharm automatically adds new configuration files to turn the folder into a Python project. Now, you can start adding scripts to the project.<\/p>\n<ol start=\"4\">\n<li>From the Project folder tree at left, under Project, right-click\u00a0PythonZoo, hover over New, and choose Python file.\u00a0Name the file\u00a0<em>SpeciesID<\/em> and click OK.<\/li>\n<\/ol>\n"},{"acf_fc_layout":"image","image":{"ID":469752,"id":469752,"title":"02","filename":"02.png","filesize":5902,"url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/02.png","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/beginners-guide-to-python-in-arcgis-pro-part-4-tutorial-cont\/attachment\/02","alt":"Create a new Python file","author":"8112","description":"","caption":"","name":"02","status":"inherit","uploaded_to":453682,"date":"2019-03-25 23:08:58","modified":"2019-03-25 23:09:15","menu_order":0,"mime_type":"image\/png","type":"image","subtype":"png","icon":"https:\/\/www.esri.com\/arcgis-blog\/wp-includes\/images\/media\/default.png","width":584,"height":187,"sizes":{"thumbnail":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/02-150x150.png","thumbnail-width":150,"thumbnail-height":150,"medium":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/02.png","medium-width":464,"medium-height":149,"medium_large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/02.png","medium_large-width":584,"medium_large-height":187,"large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/02.png","large-width":584,"large-height":187,"1536x1536":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/02.png","1536x1536-width":584,"1536x1536-height":187,"2048x2048":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/02.png","2048x2048-width":584,"2048x2048-height":187,"card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/02.png","card_image-width":584,"card_image-height":187,"wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/02.png","wide_image-width":584,"wide_image-height":187}},"image_position":"center","orientation":"horizontal","hyperlink":""},{"acf_fc_layout":"content","content":"<p style=\"padding-left: 120px\">A new\u00a0<b>editor<\/b>\u00a0window opens. Now, you\u2019re working in the SpeciesID.py file within the\u00a0PythonZoo\u00a0project. Python scripts have a .py\u00a0extension, but they are essentially just text files with a special extension that\u00a0tells the Python\u00a0interpreter\u00a0what they are.<\/p>\n<p style=\"padding-left: 120px\">You\u2019ll start your script by importing the\u00a0arcpy\u00a0<b>module<\/b>. A module is a collection of related Python functions, classes, and objects you use to accomplish a certain type of task: in the case of ArcPy, scripting for ArcGIS Pro.<\/p>\n<p style=\"padding-left: 120px\">The ArcPy module is automatically imported when you work in ArcGIS Pro, but not in PyCharm. ArcPy is one of thousands of Python modules in existence. If all of these were automatically imported, even the simplest script would take a very, very long time to run. That\u2019s why most modules must be\u00a0explicitly\u00a0imported to each script.<\/p>\n"},{"acf_fc_layout":"sidebar","content":"<p>Note: If you get stuck while following these instructions, a copy of the final script is provided in the code snippet at the end of this post for your reference.<\/p>\n","image_reference":false,"layout":"standard","image_reference_figure":"","snippet":"","spotlight_name":"","section_title":"","position":"Right","spotlight_image":false},{"acf_fc_layout":"content","content":"<ol start=\"5\">\n<li>Click inside the editor window. Type <code>import\u00a0arcpy<\/code> and press Enter.<\/li>\n<\/ol>\n<p style=\"padding-left: 120px\">Next, you\u2019ll add a second module, NumPy. While ArcPy provides most of the ArcGIS Pro-tailored functionality you need, you can combine this functionality with other modules to diversify your options. In this script, you\u2019ll use NumPy to create a list of unique values (i.e., a comprehensive list of species) from Jimmy\u2019s field sighting data.<\/p>\n<ol start=\"6\">\n<li>Type\u00a0<code>import\u00a0numpy<\/code>\u00a0and press Enter.<\/li>\n<\/ol>\n"},{"acf_fc_layout":"image","image":{"ID":469782,"id":469782,"title":"03","filename":"03.png","filesize":2008,"url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/03.png","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/beginners-guide-to-python-in-arcgis-pro-part-4-tutorial-cont\/attachment\/03","alt":"Import statments","author":"8112","description":"","caption":"PyCharm uses color and spellcheck-like underlining to notify you of potential bugs in your code or ways you could refine it. Right now, for example, the import statements appear gray because the modules have not yet been used in the script. When you use them for the first time, you\u2019ll see them change color. ","name":"03","status":"inherit","uploaded_to":453682,"date":"2019-03-25 23:13:21","modified":"2019-03-25 23:51:43","menu_order":0,"mime_type":"image\/png","type":"image","subtype":"png","icon":"https:\/\/www.esri.com\/arcgis-blog\/wp-includes\/images\/media\/default.png","width":244,"height":86,"sizes":{"thumbnail":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/03-150x86.png","thumbnail-width":150,"thumbnail-height":86,"medium":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/03.png","medium-width":244,"medium-height":86,"medium_large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/03.png","medium_large-width":244,"medium_large-height":86,"large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/03.png","large-width":244,"large-height":86,"1536x1536":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/03.png","1536x1536-width":244,"1536x1536-height":86,"2048x2048":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/03.png","2048x2048-width":244,"2048x2048-height":86,"card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/03.png","card_image-width":244,"card_image-height":86,"wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/03.png","wide_image-width":244,"wide_image-height":86}},"image_position":"center","orientation":"horizontal","hyperlink":""},{"acf_fc_layout":"content","content":"<p style=\"padding-left: 120px\">Next, you\u2019ll set the ArcPy <strong>environment<\/strong>. The environment is the location on your computer where\u00a0the\u00a0Python\u00a0interpreter will look for referenced files and store outputs by default. In this case, it\u2019s the\u00a0ZooEscape\u00a0geodatabase. When you were working in the\u00a0ZooEscape\u00a0project in\u00a0ArcGIS\u00a0Pro, you didn\u2019t have to specify that, but in PyCharm, you do.<\/p>\n<ol start=\"7\">\n<li>Press Enter again to skip a line\u00a0(leaving blank lines\u00a0makes your code more readable). Then on line 4 of the script,\u00a0type\u00a0<code>arcpy.env.workspace\u00a0= r\u201c\u201d<\/code><\/li>\n<\/ol>\n<p style=\"padding-left: 120px\">You\u2019ll paste\u00a0your local path to the\u00a0ZooEscape\u00a0geodatabase between the quotation marks. There are several ways to find it; you&#8217;ll copy it from the geodatabase settings in ArcGIS Pro.<\/p>\n"},{"acf_fc_layout":"sidebar","content":"<p>Note: in Python, the backslash \\ is sometimes used to initiate\u00a0escape sequences. For example, <code>\\n<\/code> starts a new line and <code>\\t<\/code> inserts a tab. This can\u00a0cause\u00a0issues for paths that\u00a0coincidentally contain these combinations of characters. So, as a best practice, we type the letter <code>r<\/code> before paths. <code>r<\/code> stands for \u201craw\u201d and tells the Python interpreter that the backslashes should be read simply as backslashes.<\/p>\n","image_reference":false,"layout":"standard","image_reference_figure":"","snippet":"","spotlight_name":"","section_title":"","position":"Center","spotlight_image":false},{"acf_fc_layout":"content","content":"<ol start=\"8\">\n<li>Open the\u00a0ZooEscape project you used in the <a href=\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/uncategorized\/beginners-guide-to-python-in-arcgis-pro-part-3-tutorial\/\">last tutorial<\/a> in ArcGIS Pro. In the Catalog, right-click ZooEscape.gdb\u00a0and click Properties. In the Database Properties window, copy the full path from the Name box.\u00a0Close ArcGIS Pro.<\/li>\n<li>Return to PyCharm and paste the path between the quotation marks. At the end of the line, press Enter.<\/li>\n<\/ol>\n"},{"acf_fc_layout":"image","image":{"ID":469792,"id":469792,"title":"04","filename":"04.png","filesize":6596,"url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/04.png","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/beginners-guide-to-python-in-arcgis-pro-part-4-tutorial-cont\/attachment\/04","alt":"Import statements and environment.","author":"8112","description":"","caption":"Your path will be different.","name":"04","status":"inherit","uploaded_to":453682,"date":"2019-03-25 23:19:03","modified":"2019-03-25 23:19:31","menu_order":0,"mime_type":"image\/png","type":"image","subtype":"png","icon":"https:\/\/www.esri.com\/arcgis-blog\/wp-includes\/images\/media\/default.png","width":650,"height":74,"sizes":{"thumbnail":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/04-150x74.png","thumbnail-width":150,"thumbnail-height":74,"medium":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/04.png","medium-width":464,"medium-height":53,"medium_large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/04.png","medium_large-width":650,"medium_large-height":74,"large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/04.png","large-width":650,"large-height":74,"1536x1536":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/04.png","1536x1536-width":650,"1536x1536-height":74,"2048x2048":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/04.png","2048x2048-width":650,"2048x2048-height":74,"card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/04.png","card_image-width":650,"card_image-height":74,"wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/04.png","wide_image-width":650,"wide_image-height":74}},"image_position":"center","orientation":"horizontal","hyperlink":""},{"acf_fc_layout":"content","content":"<p style=\"padding-left: 120px\">A couple of things have happened. The import statement for\u00a0ArcPy\u00a0is colored in because you\u2019ve\u00a0<b>called<\/b> (used) the module. Depending on the length of your path, you may also notice a grey underline beneath it. When you hover over it, a screentip appears telling you the line is too long because it&#8217;s over 120 characters. This is a non-critical suggestion, and\u00a0won\u2019t prevent your script from running. If the underline were red, it would signify a potentially critical problem.<\/p>\n<p style=\"padding-left: 120px\">Before each step of your script, you\u2019ll make a note\u00a0using commented\u00a0<b>pseudocode<\/b>. Pseudocode has two purposes: it guides your work as you code, and it tells anyone who reads your code later what each section is doing. You\u2019ll use the # sign at the beginning of each pseudocode line so that the interpreter will ignore it, but you can read it.<\/p>\n<ol start=\"10\">\n<li>Press Enter\u00a0to arrive at line\u00a06 and type &#8211;<\/li>\n<\/ol>\n<p style=\"padding-left: 120px\"><code># Create a new function which returns a list of species by identifying unique values in the attribute table.<\/code><\/p>\n"},{"acf_fc_layout":"image","image":{"ID":469812,"id":469812,"title":"05","filename":"05.png","filesize":4348,"url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/05.png","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/beginners-guide-to-python-in-arcgis-pro-part-4-tutorial-cont\/attachment\/05","alt":"Pseudocode","author":"8112","description":"","caption":"IDEs display commented lines of a script distinctly, so that they are easy for you to identify. In this PyCharm theme, they\u2019re italic and grey.","name":"05","status":"inherit","uploaded_to":453682,"date":"2019-03-25 23:22:31","modified":"2019-03-26 16:38:46","menu_order":0,"mime_type":"image\/png","type":"image","subtype":"png","icon":"https:\/\/www.esri.com\/arcgis-blog\/wp-includes\/images\/media\/default.png","width":652,"height":21,"sizes":{"thumbnail":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/05-150x21.png","thumbnail-width":150,"thumbnail-height":21,"medium":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/05.png","medium-width":464,"medium-height":15,"medium_large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/05.png","medium_large-width":652,"medium_large-height":21,"large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/05.png","large-width":652,"large-height":21,"1536x1536":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/05.png","1536x1536-width":652,"1536x1536-height":21,"2048x2048":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/05.png","2048x2048-width":652,"2048x2048-height":21,"card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/05.png","card_image-width":652,"card_image-height":21,"wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/05.png","wide_image-width":652,"wide_image-height":21}},"image_position":"center","orientation":"horizontal","hyperlink":""},{"acf_fc_layout":"content","content":"<p style=\"padding-left: 120px\">Now, you\u2019ll create a new function. In the previous tutorial, all the functions you used were already made for you. However, it\u2019s also a common practice to make your own functions to fulfill your specific needs. Here, you\u2019ll create a function that takes the name of an attribute table and one of its fields as inputs and returns a list of unique values as the output.<\/p>\n<ol start=\"11\">\n<li>On line 7, type the following and press Enter-<\/li>\n<\/ol>\n<p style=\"padding-left: 120px\"><code>def\u00a0getSpecies(table,field):<\/code><\/p>\n<p style=\"padding-left: 120px\">The\u00a0<code>def<\/code>\u00a0keyword signifies that you\u2019re defining a function. It\u2019s followed by the name of the function and the parameters, or arguments, that it requires. When you press Enter, the next line is automatically indented. This is where you\u2019ll write the inner workings of the function, or, in other words, what will happen behind the scenes every time you call\u00a0getSpecies.<\/p>\n<ol start=\"12\">\n<li>On line 8, type the following and press Enter-<\/li>\n<\/ol>\n<p style=\"padding-left: 120px\"><code>data =\u00a0arcpy.da.TableToNumPyArray(table, [field])<\/code><\/p>\n<p style=\"padding-left: 120px\">Here, you\u2019re converting the attribute table to a\u00a0Python class\u00a0NumPy can use, called an <strong>array<\/strong>, and assigning that array to the variable\u00a0<code>data<\/code>. You\u2019re embedding a function from ArcPy within your own, new function. The information\u00a0needed to use this\u00a0ArcPy function came from\u00a0its\u00a0<a href=\"https:\/\/pro.arcgis.com\/en\/pro-app\/arcpy\/data-access\/tabletonumpyarray.htm\" target=\"_blank\" rel=\"noopener\">help page<\/a>.<\/p>\n<p style=\"padding-left: 120px\">Now, you\u2019ll use the\u00a0<code>return<\/code>\u00a0keyword to give your function an output \u2013 a list of unique species.<\/p>\n<ol start=\"13\">\n<li>On line 9, type the following and press Enter-<\/li>\n<\/ol>\n<p style=\"padding-left: 120px\"><code>return\u00a0numpy.unique(data[field]).tolist()<\/code><\/p>\n<p style=\"padding-left: 120px\">Now that you\u2019ve created a NumPy array (<code>data<\/code>)\u00a0which contains\u00a0the information you need (<code>field<\/code>), you can use the\u00a0<a href=\"https:\/\/docs.scipy.org\/doc\/numpy\/reference\/generated\/numpy.unique.html\" target=\"_blank\" rel=\"noopener\">unique function<\/a>\u00a0to find unique values. This function automatically returns an array,\u00a0but adding\u00a0<a href=\"https:\/\/docs.scipy.org\/doc\/numpy\/reference\/generated\/numpy.ndarray.tolist.html\" target=\"_blank\" rel=\"noopener\">.tolist()<\/a>\u00a0converts it to a list, a more common data type.<\/p>\n"},{"acf_fc_layout":"image","image":{"ID":469852,"id":469852,"title":"06","filename":"06.png","filesize":9050,"url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/06.png","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/beginners-guide-to-python-in-arcgis-pro-part-4-tutorial-cont\/attachment\/06","alt":"Your new function","author":"8112","description":"","caption":"","name":"06","status":"inherit","uploaded_to":453682,"date":"2019-03-25 23:30:14","modified":"2019-03-25 23:30:23","menu_order":0,"mime_type":"image\/png","type":"image","subtype":"png","icon":"https:\/\/www.esri.com\/arcgis-blog\/wp-includes\/images\/media\/default.png","width":650,"height":57,"sizes":{"thumbnail":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/06-150x57.png","thumbnail-width":150,"thumbnail-height":57,"medium":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/06.png","medium-width":464,"medium-height":41,"medium_large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/06.png","medium_large-width":650,"medium_large-height":57,"large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/06.png","large-width":650,"large-height":57,"1536x1536":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/06.png","1536x1536-width":650,"1536x1536-height":57,"2048x2048":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/06.png","2048x2048-width":650,"2048x2048-height":57,"card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/06.png","card_image-width":650,"card_image-height":57,"wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/06.png","wide_image-width":650,"wide_image-height":57}},"image_position":"center","orientation":"horizontal","hyperlink":""},{"acf_fc_layout":"content","content":"<ol start=\"14\">\n<li>Your function is done. Press Enter to create a blank line on line 10. Next, you\u2019ll\u00a0call\u00a0the new function.<\/li>\n<li>On line 11, begin by typing the following pseudocode explanation and press Enter-<\/li>\n<\/ol>\n<p style=\"padding-left: 120px\"><code># Call the new function and assign the output to a variable.<\/code><\/p>\n<ol start=\"16\">\n<li>On line 12, type the following and press Enter-<\/li>\n<\/ol>\n<p style=\"padding-left: 120px\"><code>speciesList\u00a0=\u00a0getSpecies(\"FieldSightings_Jimmy\", \"Species\")<\/code><\/p>\n<p style=\"padding-left: 120px\">You can now use\u00a0<code>getSpecies<\/code> as you would any other built-in function. You simply fill in the required arguments (the name of a table followed by the name of a field it contains). Here, you\u2019re assigning the output to a new variable, <code>speciesList<\/code>, which can be printed.<\/p>\n"},{"acf_fc_layout":"image","image":{"ID":469872,"id":469872,"title":"07","filename":"07.png","filesize":2860,"url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/07.png","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/beginners-guide-to-python-in-arcgis-pro-part-4-tutorial-cont\/attachment\/07","alt":"Calling the new function","author":"8112","description":"","caption":"","name":"07","status":"inherit","uploaded_to":453682,"date":"2019-03-25 23:34:40","modified":"2019-03-25 23:34:50","menu_order":0,"mime_type":"image\/png","type":"image","subtype":"png","icon":"https:\/\/www.esri.com\/arcgis-blog\/wp-includes\/images\/media\/default.png","width":499,"height":40,"sizes":{"thumbnail":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/07-150x40.png","thumbnail-width":150,"thumbnail-height":40,"medium":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/07.png","medium-width":464,"medium-height":37,"medium_large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/07.png","medium_large-width":499,"medium_large-height":40,"large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/07.png","large-width":499,"large-height":40,"1536x1536":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/07.png","1536x1536-width":499,"1536x1536-height":40,"2048x2048":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/07.png","2048x2048-width":499,"2048x2048-height":40,"card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/07.png","card_image-width":499,"card_image-height":40,"wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/07.png","wide_image-width":499,"wide_image-height":40}},"image_position":"center","orientation":"horizontal","hyperlink":""},{"acf_fc_layout":"content","content":"<ol start=\"17\">\n<li>Press Enter to leave line 13 blank. On line 14, type your last pseudocode line and press Enter-<\/li>\n<\/ol>\n<p style=\"padding-left: 120px\"><code># Print the variable containing the list of species.<\/code><\/p>\n<ol start=\"18\">\n<li>On line 15 type the following and press Enter-<\/li>\n<\/ol>\n<p style=\"padding-left: 120px\"><code>print(speciesList)<\/code><\/p>\n"},{"acf_fc_layout":"sidebar","content":"<p>Note: PyCharm offers suggestions to autocomplete your code. For example, after you typed\u00a0<code>sp<\/code>, you may have noticed a\u00a0screentip with <code>speciesList<\/code>\u00a0next to a small letter\u00a0<em>v<\/em> for variable. To accept a suggestion such as this, press Tab.<\/p>\n","image_reference":false,"layout":"standard","image_reference_figure":"","snippet":"","spotlight_name":"","section_title":"","position":"Center","spotlight_image":false},{"acf_fc_layout":"content","content":"<p style=\"padding-left: 120px\">Your script is now ready to run.<\/p>\n<ol start=\"19\">\n<li>From\u00a0the Run menu, click Run&#8230; On the Run\u00a0dialog\u00a0that appears, click\u00a0SpeciesID.<\/li>\n<\/ol>\n<p style=\"padding-left: 120px\">The Run window appears beneath the Editor. After a few moments, a list of three species will appear, followed by the text\u00a0<em>Process finished with exit code 0<\/em>, meaning the\u00a0script ran successfully.<\/p>\n"},{"acf_fc_layout":"image","image":{"ID":469972,"id":469972,"title":"08","filename":"08.png","filesize":8886,"url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/08.png","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/beginners-guide-to-python-in-arcgis-pro-part-4-tutorial-cont\/attachment\/08","alt":"Run window","author":"8112","description":"","caption":"","name":"08","status":"inherit","uploaded_to":453682,"date":"2019-03-25 23:39:34","modified":"2019-03-25 23:39:44","menu_order":0,"mime_type":"image\/png","type":"image","subtype":"png","icon":"https:\/\/www.esri.com\/arcgis-blog\/wp-includes\/images\/media\/default.png","width":650,"height":93,"sizes":{"thumbnail":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/08-150x93.png","thumbnail-width":150,"thumbnail-height":93,"medium":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/08.png","medium-width":464,"medium-height":66,"medium_large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/08.png","medium_large-width":650,"medium_large-height":93,"large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/08.png","large-width":650,"large-height":93,"1536x1536":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/08.png","1536x1536-width":650,"1536x1536-height":93,"2048x2048":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/08.png","2048x2048-width":650,"2048x2048-height":93,"card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/08.png","card_image-width":650,"card_image-height":93,"wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/03\/08.png","wide_image-width":650,"wide_image-height":93}},"image_position":"center","orientation":"horizontal","hyperlink":""},{"acf_fc_layout":"content","content":"<p style=\"padding-left: 120px\">If you didn\u2019t get the expected results, check your work against this code snippet\u00a0(you\u2019ll still have to fill in the path to your local geodatabase, though):<\/p>\n"},{"acf_fc_layout":"sidebar","content":"","image_reference":false,"layout":"code_snippet","image_reference_figure":"","snippet":"import arcpy\r\nimport numpy\r\n\r\narcpy.env.workspace = r\"YOUR PATH HERE\"\r\n\r\n# Create a new function which returns a list of species by identifying unique values in the attribute table.\r\ndef getSpecies(table,field):\r\n   data = arcpy.da.TableToNumPyArray(table, [field])\r\n   return numpy.unique(data[field]).tolist()\r\n\r\n# Call the new function and assign the output to a variable.\r\nspeciesList = getSpecies(\"FieldSightings_Jimmy\", \"Species\")\r\n\r\n# Print the variable containing the list of species.\r\nprint(speciesList)","spotlight_name":"","section_title":"","position":"Center","spotlight_image":false},{"acf_fc_layout":"content","content":"<ol start=\"20\">\n<li>You can now close PyCharm; your changes were automatically saved.<\/li>\n<\/ol>\n<p>You now have a short script in your arsenal that automates a task: identifying the species of zoo animals that Jimmy saw. It\u2019s a simple task, yes, but one that could scale. Imagine if you wanted to extract unique values from an attribute table that was thousands of records long, or if you had dozens of datasets. By changing the inputs or adding some loops to this script, you could handle either of those situations quickly. That\u2019s the power of automation \u2013 in the real word just as much as in the fictional universe where the Redlands Zoo exists.<\/p>\n<h2>Back to reality<\/h2>\n<p>That\u2019s it for your whirlwind tour of the Python window and an IDE.\u00a0This is just a small example of what you can accomplish with these tools and is by no means comprehensive.\u00a0But my hope is that this blog mini-series has\u00a0gotten you excited to practice, gain\u00a0a thorough understanding of these concepts,\u00a0and\u00a0then go\u00a0beyond\u00a0them.<\/p>\n<p>If you thought this exercise was fun, I encourage you to come up with an equally bogus scenario and try to write a script around it. Remember, I just started learning Python\u00a0recently myself, and I was able to put this tutorial together using the resources I outline in a <a href=\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/uncategorized\/beginners-guide-to-python-in-arcgis-pro-part-2-how\/\">previous post<\/a>. If I can do it, so can you!<\/p>\n"},{"acf_fc_layout":"sidebar","content":"<p>Note: Remember in <a href=\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/uncategorized\/beginners-guide-to-python-in-arcgis-pro-part-2-how\/\">post two<\/a> how I mentioned that a lot of your coding work will come from re-purposing existing samples? Well, here\u2019s the <a class=\"Hyperlink SCXW223851689 BCX0\" href=\"https:\/\/arcpy.wordpress.com\/2012\/02\/01\/create-a-list-of-unique-field-values\/\" target=\"_blank\" rel=\"noopener noreferrer\">source<\/a> I used to come up with the work flow in this post. It\u2019s an old blog post, but useful \u2013 it details two ways to return unique values from a table. If you\u2019re feeling ambitious, try the other way!<\/p>\n","image_reference":false,"layout":"standard","image_reference_figure":"","snippet":"","spotlight_name":"","section_title":"","position":"Center","spotlight_image":false}],"authors":[{"ID":8112,"user_firstname":"Olivia","user_lastname":"Iannone","nickname":"OIannone","user_nicename":"oiannone","display_name":"Olivia Iannone","user_email":"OIannone@esri.com","user_url":"","user_registered":"2018-06-22 21:48:46","user_description":"I'm a technical writer for ArcGIS Pro who came to Esri after my wildlife biology studies exposed me to the power of GIS. I'm fascinated by how communicating creatively with data connects people to places, and committed to providing ArcGIS Pro users with the information they need to succeed. When I'm not at work, I love to ski, travel, or do anything else that gets me outdoors.","user_avatar":"<img data-del=\"avatar\" src='https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/20190107_165036-213x200.jpg' class='avatar pp-user-avatar avatar-96 photo ' height='96' width='96'\/>"}],"related_articles":[{"ID":443452,"post_author":"8112","post_date":"2019-02-26 08:52:12","post_date_gmt":"2019-02-26 16:52:12","post_content":"","post_title":"Beginner's guide to Python in ArcGIS Pro, Part 1: Why?","post_excerpt":"","post_status":"publish","comment_status":"closed","ping_status":"closed","post_password":"","post_name":"beginners-guide-to-python-in-arcgis-pro-part-1-why","to_ping":"","pinged":"","post_modified":"2019-03-18 11:20:43","post_modified_gmt":"2019-03-18 18:20:43","post_content_filtered":"","post_parent":0,"guid":"http:\/\/www.esri.com\/arcgis-blog\/?post_type=blog&#038;p=443452","menu_order":0,"post_type":"blog","post_mime_type":"","comment_count":"0","filter":"raw"},{"ID":447382,"post_author":"8112","post_date":"2019-02-27 09:16:32","post_date_gmt":"2019-02-27 17:16:32","post_content":"","post_title":"Beginner\u2019s guide to Python in ArcGIS Pro, Part 2: How?","post_excerpt":"","post_status":"publish","comment_status":"closed","ping_status":"closed","post_password":"","post_name":"beginners-guide-to-python-in-arcgis-pro-part-2-how","to_ping":"","pinged":"","post_modified":"2020-06-19 10:56:16","post_modified_gmt":"2020-06-19 17:56:16","post_content_filtered":"","post_parent":0,"guid":"http:\/\/www.esri.com\/arcgis-blog\/?post_type=blog&#038;p=447382","menu_order":0,"post_type":"blog","post_mime_type":"","comment_count":"0","filter":"raw"},{"ID":450012,"post_author":"8112","post_date":"2019-03-18 11:13:51","post_date_gmt":"2019-03-18 18:13:51","post_content":"","post_title":"Beginner's guide to Python in ArcGIS Pro, Part 3: Tutorial","post_excerpt":"","post_status":"publish","comment_status":"closed","ping_status":"closed","post_password":"","post_name":"beginners-guide-to-python-in-arcgis-pro-part-3-tutorial","to_ping":"","pinged":"","post_modified":"2022-03-08 15:37:36","post_modified_gmt":"2022-03-08 23:37:36","post_content_filtered":"","post_parent":0,"guid":"http:\/\/www.esri.com\/arcgis-blog\/?post_type=blog&#038;p=450012","menu_order":0,"post_type":"blog","post_mime_type":"","comment_count":"0","filter":"raw"}],"card_image":false,"wide_image":false},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.9 (Yoast SEO v25.9) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Beginner&#039;s guide to Python in ArcGIS Pro, Part 4: Tutorial cont.<\/title>\n<meta name=\"description\" content=\"Create a standalone script for use with your ArcGIS Pro project in this step-by-step tutorial for beginner Python users.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/beginners-guide-to-python-in-arcgis-pro-part-4-tutorial-cont\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Beginner&#039;s guide to Python in ArcGIS Pro, Part 4: Tutorial cont.\" \/>\n<meta property=\"og:description\" content=\"Create a standalone script for use with your ArcGIS Pro project in this step-by-step tutorial for beginner Python users.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/beginners-guide-to-python-in-arcgis-pro-part-4-tutorial-cont\" \/>\n<meta property=\"og:site_name\" content=\"ArcGIS Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/esrigis\/\" \/>\n<meta property=\"article:modified_time\" content=\"2019-07-31T23:30:16+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@ESRI\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":[\"Article\",\"BlogPosting\"],\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/beginners-guide-to-python-in-arcgis-pro-part-4-tutorial-cont#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/beginners-guide-to-python-in-arcgis-pro-part-4-tutorial-cont\"},\"author\":{\"name\":\"Olivia Iannone\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/54fdb9030f5a49100e0c0f41afe93b32\"},\"headline\":\"Beginner&#8217;s guide to Python in ArcGIS Pro, Part 4: Tutorial cont.\",\"datePublished\":\"2019-03-26T16:46:43+00:00\",\"dateModified\":\"2019-07-31T23:30:16+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/beginners-guide-to-python-in-arcgis-pro-part-4-tutorial-cont\"},\"wordCount\":11,\"publisher\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#organization\"},\"keywords\":[\"ArcPy\",\"IDE\",\"Learn\",\"python\",\"Tutorial\"],\"articleSection\":[\"Analytics\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/beginners-guide-to-python-in-arcgis-pro-part-4-tutorial-cont\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/beginners-guide-to-python-in-arcgis-pro-part-4-tutorial-cont\",\"name\":\"Beginner's guide to Python in ArcGIS Pro, Part 4: Tutorial cont.\",\"isPartOf\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#website\"},\"datePublished\":\"2019-03-26T16:46:43+00:00\",\"dateModified\":\"2019-07-31T23:30:16+00:00\",\"description\":\"Create a standalone script for use with your ArcGIS Pro project in this step-by-step tutorial for beginner Python users.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/beginners-guide-to-python-in-arcgis-pro-part-4-tutorial-cont#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/beginners-guide-to-python-in-arcgis-pro-part-4-tutorial-cont\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/beginners-guide-to-python-in-arcgis-pro-part-4-tutorial-cont#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.esri.com\/arcgis-blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Beginner&#8217;s guide to Python in ArcGIS Pro, Part 4: Tutorial cont.\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#website\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/\",\"name\":\"ArcGIS Blog\",\"description\":\"Get insider info from Esri product teams\",\"publisher\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.esri.com\/arcgis-blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#organization\",\"name\":\"Esri\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2018\/04\/Esri.png\",\"contentUrl\":\"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2018\/04\/Esri.png\",\"width\":400,\"height\":400,\"caption\":\"Esri\"},\"image\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/esrigis\/\",\"https:\/\/x.com\/ESRI\",\"https:\/\/www.linkedin.com\/company\/5311\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/54fdb9030f5a49100e0c0f41afe93b32\",\"name\":\"Olivia Iannone\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/20190107_165036-213x200.jpg\",\"contentUrl\":\"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/20190107_165036-213x200.jpg\",\"caption\":\"Olivia Iannone\"},\"description\":\"I'm a technical writer for ArcGIS Pro who came to Esri after my wildlife biology studies exposed me to the power of GIS. I'm fascinated by how communicating creatively with data connects people to places, and committed to providing ArcGIS Pro users with the information they need to succeed. When I'm not at work, I love to ski, travel, or do anything else that gets me outdoors.\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/author\/oiannone\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Beginner's guide to Python in ArcGIS Pro, Part 4: Tutorial cont.","description":"Create a standalone script for use with your ArcGIS Pro project in this step-by-step tutorial for beginner Python users.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/beginners-guide-to-python-in-arcgis-pro-part-4-tutorial-cont","og_locale":"en_US","og_type":"article","og_title":"Beginner's guide to Python in ArcGIS Pro, Part 4: Tutorial cont.","og_description":"Create a standalone script for use with your ArcGIS Pro project in this step-by-step tutorial for beginner Python users.","og_url":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/beginners-guide-to-python-in-arcgis-pro-part-4-tutorial-cont","og_site_name":"ArcGIS Blog","article_publisher":"https:\/\/www.facebook.com\/esrigis\/","article_modified_time":"2019-07-31T23:30:16+00:00","twitter_card":"summary_large_image","twitter_site":"@ESRI","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":["Article","BlogPosting"],"@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/beginners-guide-to-python-in-arcgis-pro-part-4-tutorial-cont#article","isPartOf":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/beginners-guide-to-python-in-arcgis-pro-part-4-tutorial-cont"},"author":{"name":"Olivia Iannone","@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/54fdb9030f5a49100e0c0f41afe93b32"},"headline":"Beginner&#8217;s guide to Python in ArcGIS Pro, Part 4: Tutorial cont.","datePublished":"2019-03-26T16:46:43+00:00","dateModified":"2019-07-31T23:30:16+00:00","mainEntityOfPage":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/beginners-guide-to-python-in-arcgis-pro-part-4-tutorial-cont"},"wordCount":11,"publisher":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/#organization"},"keywords":["ArcPy","IDE","Learn","python","Tutorial"],"articleSection":["Analytics"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/beginners-guide-to-python-in-arcgis-pro-part-4-tutorial-cont","url":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/beginners-guide-to-python-in-arcgis-pro-part-4-tutorial-cont","name":"Beginner's guide to Python in ArcGIS Pro, Part 4: Tutorial cont.","isPartOf":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/#website"},"datePublished":"2019-03-26T16:46:43+00:00","dateModified":"2019-07-31T23:30:16+00:00","description":"Create a standalone script for use with your ArcGIS Pro project in this step-by-step tutorial for beginner Python users.","breadcrumb":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/beginners-guide-to-python-in-arcgis-pro-part-4-tutorial-cont#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/beginners-guide-to-python-in-arcgis-pro-part-4-tutorial-cont"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-pro\/analytics\/beginners-guide-to-python-in-arcgis-pro-part-4-tutorial-cont#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.esri.com\/arcgis-blog\/"},{"@type":"ListItem","position":2,"name":"Beginner&#8217;s guide to Python in ArcGIS Pro, Part 4: Tutorial cont."}]},{"@type":"WebSite","@id":"https:\/\/www.esri.com\/arcgis-blog\/#website","url":"https:\/\/www.esri.com\/arcgis-blog\/","name":"ArcGIS Blog","description":"Get insider info from Esri product teams","publisher":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.esri.com\/arcgis-blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.esri.com\/arcgis-blog\/#organization","name":"Esri","url":"https:\/\/www.esri.com\/arcgis-blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2018\/04\/Esri.png","contentUrl":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2018\/04\/Esri.png","width":400,"height":400,"caption":"Esri"},"image":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/esrigis\/","https:\/\/x.com\/ESRI","https:\/\/www.linkedin.com\/company\/5311\/"]},{"@type":"Person","@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/54fdb9030f5a49100e0c0f41afe93b32","name":"Olivia Iannone","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/image\/","url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/20190107_165036-213x200.jpg","contentUrl":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/07\/20190107_165036-213x200.jpg","caption":"Olivia Iannone"},"description":"I'm a technical writer for ArcGIS Pro who came to Esri after my wildlife biology studies exposed me to the power of GIS. I'm fascinated by how communicating creatively with data connects people to places, and committed to providing ArcGIS Pro users with the information they need to succeed. When I'm not at work, I love to ski, travel, or do anything else that gets me outdoors.","url":"https:\/\/www.esri.com\/arcgis-blog\/author\/oiannone"}]}},"text_date":"March 26, 2019","author_name":"Olivia Iannone","author_page":"https:\/\/www.esri.com\/arcgis-blog\/author\/oiannone","custom_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2025\/08\/Newsroom-Keyart-Wide-1920-x-1080.jpg","primary_product":"ArcGIS Pro","tag_data":[{"term_id":31181,"name":"ArcPy","slug":"arcpy","term_group":0,"term_taxonomy_id":31181,"taxonomy":"post_tag","description":"","parent":0,"count":32,"filter":"raw"},{"term_id":359062,"name":"IDE","slug":"ide","term_group":0,"term_taxonomy_id":359062,"taxonomy":"post_tag","description":"","parent":0,"count":1,"filter":"raw"},{"term_id":122232,"name":"Learn","slug":"learn","term_group":0,"term_taxonomy_id":122232,"taxonomy":"post_tag","description":"","parent":0,"count":14,"filter":"raw"},{"term_id":24341,"name":"python","slug":"python","term_group":0,"term_taxonomy_id":24341,"taxonomy":"post_tag","description":"","parent":0,"count":171,"filter":"raw"},{"term_id":27911,"name":"Tutorial","slug":"tutorial","term_group":0,"term_taxonomy_id":27911,"taxonomy":"post_tag","description":"","parent":0,"count":184,"filter":"raw"}],"category_data":[{"term_id":23341,"name":"Analytics","slug":"analytics","term_group":0,"term_taxonomy_id":23341,"taxonomy":"category","description":"","parent":0,"count":1333,"filter":"raw"}],"product_data":[{"term_id":36561,"name":"ArcGIS Pro","slug":"arcgis-pro","term_group":0,"term_taxonomy_id":36561,"taxonomy":"product","description":"","parent":0,"count":2046,"filter":"raw"}],"primary_product_link":"https:\/\/www.esri.com\/arcgis-blog\/?s=#&products=arcgis-pro","_links":{"self":[{"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/blog\/453682","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/blog"}],"about":[{"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/types\/blog"}],"author":[{"embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/users\/8112"}],"replies":[{"embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/comments?post=453682"}],"version-history":[{"count":0,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/blog\/453682\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/media?parent=453682"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/categories?post=453682"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/tags?post=453682"},{"taxonomy":"industry","embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/industry?post=453682"},{"taxonomy":"product","embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/product?post=453682"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}