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.
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.
- 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
- Python for Everyone Using ArcGIS 10.1
- Codecademy Python Track offers free online coding lessons, including Python. Use this to get the feel of how python works before working on ArcPy. You'll be glad of having the basics down when you work with ArcPy.
- Google’s Python Class
- ESRI – Using Python in ArcGIS Desktop 10
- Penn State – GEOG 485 – GIS Programming and Automation
- ArcPy for Python Developers using ArcGIS Pro
- Check out the free Virtual Campus presentation on ArcPy. It's a bit dry, but it will help orient you to how ArcGIS implements Python. After this presentation, you'll have a better idea of what is possible with ArcPy and know what tasks you can realistically accomplish. It looks like they've got a bona fide Python course as well.
- 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.
I often train people in using ArcMap and our training course introduces people to Python and arcpy. I try so hard to make people read the Help file! What is it about people not reading the help file, it drives me nuts!
If you open the help file of any geo-processing tool, it always gives a sample of python code using that tool. This is a great way of learning how to interact with the arcpy module in a Python environment.
For a beginner, it's free and built right into the application help file. As you want to do more sophisticated stuff then go for the resources that have been collated on this thread.
The only thing I would add is build something in model builder and export it to a Python script to give you an idea how the different components fits together.
ESRI has Python Scripting courses:
And there is a free introduction online seminar in ESRI training website: Using Python in ArcGIS 10