This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# @author Cindy Williams | |
# @date 25/06/2013 | |
# | |
# Loops over an existing spreadsheet with attribute data | |
# and builds up a definition query to apply to the dataset. | |
# | |
# For use in the Python window in ArcMap. | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
@date 19/07/2016 | |
@author Cindy Williams-Jayakumar | |
Replaces the delimiter in a csv file | |
using the pathlib library in Python 3 | |
''' | |
import csv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
@date 09/07/2013 | |
@author Cindy Williams | |
Converts a spreadsheet containing field names and aliases | |
into a file geodatabase table. | |
''' | |
import arcpy | |
xls = r"C:\Some\Arb\Folder\test.xlsx\Fields$" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import geocoder | |
import pandas as pd | |
xls = r'C:\Some\Arb\Folder\coords.xls' | |
out_xls = r'C:\Some\Arb\Folder\geocoded.xls' | |
df = pd.read_excel(xls) | |
for index, row in df.iterrows(): | |
g = geocoder.google([row[3], row[2]], method='reverse') | |
df.set_value(index, 'Street Address', g.address) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
@date 12/10/2015 | |
@author Cindy Williams | |
Adds a new field to layers in a map document, based | |
on a current field. | |
For use in the Python window in ArcMap. | |
''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# @date 03/07/2015 | |
# @author Cindy Williams | |
# | |
# Sorts the TOC in ArcMap alphabetically using | |
# a temporary group layer for reference. This group | |
# layer should be empty, and can be created anywhere | |
# in the TOC. | |
# | |
# For use in the Python window in ArcMap. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
in_xls = r"C:\Some\Arb\Folder\test.xlsx" | |
columns = [0, 2, 3, 4, 6, 8] | |
# Use a function to define the mask | |
# to create a subset of the data frame | |
def mask(df, key, value): | |
return df[df[key] == value] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import arcpy | |
lyr = arcpy.mapping.Layer(r'C:\Some\Arb\Folder\work.gdb\ftr_test') | |
cursor = arcpy.da.UpdateCursor(lyr, 'Name') | |
for i in xrange(10): | |
for e in ['X', 'Y']: | |
upd.next() # Increment the cursor | |
upd.updateRow(['Zone ' + str(i) + e]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# @date 06/08/2015 | |
# @author Cindy Williams | |
# | |
# Creates random points in each polygon feature | |
# without the need for an Advanced licence to run | |
# the Create Random Points tool. | |
# | |
# For use in the Python window in ArcCatalog. | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import docx | |
import xlwt | |
doc = r"C:\Some\Arb\Folder\input.docx" | |
xls = r"C:\Some\Arb\Folder\output.xls" | |
document = docx.Document(doc) | |
book = xlwt.Workbook() | |
cur_sheet = book.add_sheet("Tables") | |
row_num = 0 |