Skip to content

Instantly share code, notes, and snippets.

Cindy Jayakumar cindygis

Block or report user

Report or block cindygis

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@cindygis
cindygis / changeDelimiterInCSV.py
Created Jul 19, 2016
Replaces the delimiter in a csv file
View changeDelimiterInCSV.py
'''
@date 19/07/2016
@author Cindy Williams-Jayakumar
Replaces the delimiter in a csv file
using the pathlib library in Python 3
'''
import csv
@cindygis
cindygis / createTableFieldsFromXLS.py
Created May 5, 2016
Converts a spreadsheet containing field names and aliases into a file geodatabase table.
View createTableFieldsFromXLS.py
'''
@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$"
@cindygis
cindygis / reverseGeocodeXLScoords.py
Created Apr 21, 2016
Quickly reverse geocode coordinates in a spreadsheet
View reverseGeocodeXLScoords.py
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)
@cindygis
cindygis / addFieldWithExtendTable.py
Last active Mar 31, 2016
Adds a new field using a numpy array to layers in a map document.
View addFieldWithExtendTable.py
'''
@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.
'''
@cindygis
cindygis / sortArcMapTOC.py
Created Jul 3, 2015
Sorts the TOC in ArcMap alphabetically by using a temporary group layer for reference.
View sortArcMapTOC.py
#
# @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.
@cindygis
cindygis / filterDataFrameUsingMask.py
Created Dec 17, 2015
Filters a pandas data frame using a mask
View filterDataFrameUsingMask.py
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]
@cindygis
cindygis / updateRowsWithNestedLoop.py
Created Dec 4, 2015
Updates a field using a nested loop in an arcpy update cursor
View updateRowsWithNestedLoop.py
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])
@cindygis
cindygis / createRandomPointsInPoly.py
Last active Oct 14, 2015
Creates random points in each polygon feature. Bypasses the Advanced licence needed to run the Create Random Points tool in ArcMap.
View createRandomPointsInPoly.py
#
# @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.
#
@cindygis
cindygis / extractDOCtablesToXLS.py
Created Sep 29, 2015
Writes the contents of all rows from multiple tables in a Word document to a spreadsheet.
View extractDOCtablesToXLS.py
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
@cindygis
cindygis / writeFieldsToDOC.py
Created Sep 21, 2015
Uses the python-docx package to write various properties of a feature class to docx format.
View writeFieldsToDOC.py
'''
@date 15/09/2015
@author Cindy Williams
Uses the python-docx package to write various
properties of a feature class to docx format.
'''
import arcpy
You can’t perform that action at this time.