Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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 '14 at 16:10
    
@Aaron if it's a float field, do you have to put the 1 in quotes? – ianbroad Apr 3 '14 at 16:12
1  
It is optional @ian – Aaron Apr 3 '14 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.