Create, copying, and listing data with Python
For this week’s lesson, we learned how to manipulate and explore data through python without directly opening the files in ArcGIS Pro. I wrote a script of roughly 50 lines that created a new geodatabase (.gdb file), copied a set of shape files, and printed the data with the respective information.
I made some very small, but costly errors that ended up adding on some extra hours to my work. One of the first mistakes I made was mixing up “workspace” and “workplace” in my code. Working on this, especially after hours of staring at a screen, was an easy oversite and it took me a long time to find the error. Luckily, I learned to utilize the power of CTRL+F for the rest of writing this script.
Another error was forgetting that the “population” data, unlike “name” and “feature” were not as identical in naming. So, I initially forgot I had to write it in as POP_2000 as that was the name of the feature.
Finally, we come to the end result, which took multiple attempts at writing perfectly. The first time I kept getting one that just listed the city name and population.
While this most likely would have been sufficient, I wanted something more detailed and similar to the example that was given. It wasn’t identical but to me this was close enough.
Comments
Post a Comment