3

this is a novice question

I have an attribute field that's missing a piece of information, i'd like to amend the attribute field like below:

This is the current attribute field:

"V:\Building & Development...."

and i'd like to add "\Engineering" to attribute field

"V:\Engineering\Building & Development...."

I have to make this change to 1441 attribute fields, not sure how to write the python script in the field calculator. I'm doing this on ArcGIS 10.2 for Desktop

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Jun 23, 2015 at 20:16
0

1 Answer 1

3

Using the Python parser in the field calculator:

Pre-logic script code:

def convert(x):
 a = x.split(":")
 return a[0] + ":\Engineering" + a[1]

convert(!text_field!)

You can also use an UpdateCursor to do this

import arcpy
fc = r'path\to\your\fc'
with arcpy.da.UpdateCursor(fc, "your_field") as cursor:
 for row in cursor:
 if row[0] != None:
 a = row[0].split(":")
 row[0] = a[0] + ":\Engineering" + a[1]
 cursor.updateRow(row)

answered Jun 23, 2015 at 20:32
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.