Where can I start to learn ArcPy?
This question has been converted to Community Wiki and wiki locked because it is an example of a question that seeks a list of answers and appears to be popular enough to protect it from closure. It should be treated as a special case and should not be viewed as the type of question that is encouraged on this, or any Stack Exchange site, but if you wish to contribute more content to it then feel free to do so by editing this answer.
Look at posts here and on other websites that use Python scripts and try to deconstruct them and see what techniques the authors are using to accomplish their task. Our self-assembling FAQ on ArcPy is well worth reviewing for this purpose.
You will find it educational to try to solve other people's problems. We have a self-assembling list of unanswered questions on ArcPy to help you find them.
Do not forget that you can right-click any geoprocessing result and click "Copy as Python Snippet" if you just want to get the syntax of a function call, which is especially useful for things like field mappings and code blocks. It is also possible to export ModelBuilder models to Python code, but there is no guarantee that the code exported from a working model will also work in Python, and for all but the simplest models the code that results is often difficult for beginners to debug.
Read the help files!! 90% of ArcPy is just the same as using the GUI tools, only you are starting them using Python. The help files all have example Python code at the bottom.
- What is ArcPy? is the front page to Help on using ArcPy with ArcMap from versions 10.3 - 10.8
- ArcGIS Desktop Help (9.3)
- ArcGIS Desktop Help (10)
- ArcGIS Desktop Help (10.1)
- ArcGIS Desktop Help (10.2)
- ArcGIS Desktop Help (10.3)
- ArcGIS Desktop Help (10.4)
- ArcGIS Desktop Help (10.5)
- ArcGIS Desktop Help (10.6)
- ArcGIS Pro Help
- Python migration from 10.x to ArcGIS Pro
- ArcGIS for Python API (not ArcPy)
- How to Think Like a Computer Scientist
- Dive into Python
- A Byte of Python (2.x)
- Learn Python the Hard Way
- Codecademy Python Track offers free online coding lessons, including Python. Use this to get the feel of how Python works before working on ArcPy.
- Google’s Python Class
- Penn State – GEOG 485 – GIS Programming and Automation
- ArcPy for Python Developers using ArcGIS Pro
- Non-Programmer’s Tutorial for Python 2.6
- Official Python Tutorial (2.5.4)
- Official Python Tutorial (2.6.5)
- Official Python Tutorial (2.7)
- Doug Hellmann's Python Module of the Week (PyMOTW) site
- Code Like a Pythonista: Idiomatic Python
- Progression path - using Python for GIS: from apprentice to guru
- Python 2.5.4 Documentation (for ArcGIS 9.3)
- Python 2.6.5 Documentation (for ArcGIS 10)
- Python 2.7 Documentation (for ArcGIS 10.1-10.6)
- Python 3.6 Documentation (for ArcGIS Pro)
- Getting Started with Python in ArcGIS 10 (from 2010)
- ArcGIS Geoprocessing: Python Scripting – Advanced Techniques (from 2009)
- Python Scripting for Map Automation in ArcGIS 10 (from 2010)
- Python in a Nutshell, 2nd Ed
- Learning Python, 3rd Ed
- Programming Python, 3rd Ed
- Python Cookbook, 2nd Ed
- A Python Primer for ArcGIS
- Python Scripting for ArcGIS
- GIS Tutorial for Python Scripting (coming June 2014)
Tools/Integrated Development Environments (IDEs) - Non-commercial:
- PyDev (plug-in for the Eclipse software development environment)
- Python Tools for Visual Studio
- Winpdb (debugger)
- Django (web application framework)
- comtypes (for using ArcObjects in Python)
- PyPI - the Python Package Index
- Seeking Python tools/modules/add-ins for GIS?
I highly recommend reading Programming ArcGIS 10.1 with Python Cookbook.
From my own experience, you cannot strictly learn the arcpy site package without eventually bringing in larger concepts from the Python programming language. In fact, I first tried to take the approach you are eluding to, where I began using the arcpy site package to automate processes in ArcGIS. However, I quickly found myself paging through Python documentation looking for better approaches to, for example, manipulate paths such as with
os.path.join(). I also found that I had been avoiding incredibly powerful Python libraries such as NumPy and SciPy by accepting the ESRI alternatives. In sum I would recommend the following steps to learn Python fundamentals complimented by the arcpy site package:
- First: use an IDE such as PythonWin or PyScripter to do all of your scripting! It takes too many people too long to realize that they can implement and debug scripts outside of the ArcGIS python window.
- Perform even the most simple tasks using Python. For example, define a workspace and create a geodatabase programmatically. Don't start out creating complicated scripts.
- It's okay to do all of your scripting using arcpy initially--just keep in mind there are better, more efficient methods for many tasks. Always look for a better alternative with pure Python, if necessary.
- Find programmatic solutions to inquiries on this site. This will definitely help round out your abilities, as it exposes you to problems outside of your comfort zone.
- Finally, once you believe you have a good grasp of Python, take an instructor led course from ESRI such as Introduction to Geoprocessing Scripts Using Python. Yes, these courses are expensive, but they are valuable and will really reinforce what you've already learned. Just do not go into one of these courses without a good grasp of the major concepts.