1

I want to do this basically in the Field Calculator ArcMap using its Python Parser:

if !AELEG! == 'L04'
 !rock_type_age!.replace('Mid-Pleistocene-Holocene volcanic rocks (mainly rhyolite and dacite pyroclastic flow deposits')

So the field name with the codes is AELEG and the code in question here is L04, for every row in the field rock_type_age that corresponds to L04 in the field AELEG I want to add a string (in this case 'Mid-Pleistocene-Holocene volcanic rocks (mainly rhyolite and dacite pyroclastic flow deposits'))

Any suggestions?

1 Answer 1

1

You could just select rows that are L04 and field calculate them without a function.

Replace function should not be used for this. It is for modifying an existing string, see: https://www.tutorialspoint.com/python/string_replace.htm

Pre-logic:

def f(aeleg):
   if  aeleg == 'L04':
      return 'Mid-Pleistocene-Holocene volcanic rocks (mainly rhyolite and dacite pyroclastic flow deposits'

Call with:

f(!AELEG!)

enter image description here

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.