Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have a float field which I want to simply update all values with 1. I can easily do this within the field calculator but I have started using python today, what is the syntax to simply update a field with the value 1. I'm stuck on the expression bit of the script:

arcpy.CalculateField_management("ROCHDALE_TEST_NET","FRMEAS",??????

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Looking at the ArcGIS help section, you can see the necessary parameters and descriptions:

CalculateField_management (in_table, field, expression, {expression_type}, {code_block})

To translate this to your script;

import arcpy

file = r'C:\your\file.shp'

arcpy.CalculateField_management (file, "FRMEAS", "1")
share|improve this answer
    
Thanks, I was thinking into it to much by doing =1 or "!FRMEAS! = 1" –  Alan Carr Apr 3 at 16:10
    
@Aaron if it's a float field, do you have to put the 1 in quotes? –  ian Apr 3 at 16:12
1  
It is optional @ian –  Aaron Apr 3 at 16:16

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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