Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 115

For questions about ArcGIS Python Parser for labelling expressions and field calculations

2 votes

Using arcpy.CalculateField_management

I think this may be what you are after - the syntax is not one that I try to remember. I simply ran the Calculate Field tool once interactively using the Expression and Code Block from your questio …
PolyGeo's user avatar
  • 65.4k
1 vote

ArcGIS Python Field Calculation says failure during processing?

I think the cause of this, and the reason you are also having trouble formatting this correctly in the question, is that there is a colon missing after else. Try this: def reclass(a): if (a <= 5 …
PolyGeo's user avatar
  • 65.4k
1 vote
Accepted

Field calculation based on the field name by using arcpy

You seem to know how to do this in the ArcGIS Field Calculator. Instead, do exactly the same thing using the Calculate Field tool, taking care to set your parser to Python. Once you have run the too …
PolyGeo's user avatar
  • 65.4k
4 votes
Accepted

Using Python Parser of Label Expression to only show text after particular symbol?

I would use a Python expression like the following by checking Advanced on the Label Expression dialog of the Labels tab of the Properties dialog: def FindLabel ( [TestField] ): return [TestField]. …
PolyGeo's user avatar
  • 65.4k
4 votes
Accepted

Using if else statement in Python Parser of Field Calculator in ArcGIS for Desktop?

The problem is in your code block. Instead of: def Reclass( !CODE! , !COMPLEX! ): if ( !CODE! == 1.1.7 and !COMPLEX! == 4): return 1.3 elif ( !CODE! == 3.2.0 and !COMPLEX! == 4): …
PolyGeo's user avatar
  • 65.4k
3 votes

Removing numeric characters from alphanumeric value in field calculation?

I would start with this simple case: >>> x = "A-AA00" >>> print x A-AA00 >>> print x.replace("0","") A-AA >>> From there some of the codeblock examples for Python from the ArcGIS 10 Help should gi …
PolyGeo's user avatar
  • 65.4k
7 votes
Accepted

Choosing first letters of words in attribute table using Python Parser of ArcMap Field Calcu...

Expanding on the answer from cag I just tested the code below which should do what you want. You just need to have your original and new field (called OrigField and NewField in my test) already in th …
PolyGeo's user avatar
  • 65.4k
3 votes
Accepted

ERROR 000539: Invalid Field !FULLNAME

The first thing that I would check is whether your feature class has a field called FULLNAME. The error message that you are receiving suggests that it does not.
PolyGeo's user avatar
  • 65.4k
3 votes

Using ArcPy to multiply fields in attribute table?

I think the easiest way to learn "how to use ArcPy to run a field calculation" is to: Go to the Search window and find the Calculate Field tool Open its tool dialog Configure a test calculation and …
PolyGeo's user avatar
  • 65.4k
1 vote

Unable to replace Null values using Python parser of ArcGIS 10.0 Field Calculator?

The underlying cause of this problem seems to be bug number NIM059424 which was present in ArcGIS Desktop 10.0 and resolved by ArcGIS 10.1 for Desktop: Null values in the feature class do not get …
PolyGeo's user avatar
  • 65.4k
0 votes

Importing text only out of string field to new field for labelling in ArcMap?

This question, and its first answer, appear to have been written at a time prior to the Python Parser becoming available for writing Label Expressions. In this case I think the expression (untested) …
PolyGeo's user avatar
  • 65.4k
1 vote

Referencing external CSV file within ArcMap field calculator using python codeblock?

Yes, as @Fezter commented: if you wanted to you could import the csv module and read the file that way but I think it would be easier to just use the Join Field tool: Joins the contents of …
PolyGeo's user avatar
  • 65.4k
11 votes
Accepted

Changing default parser in ArcGIS Field Calculator to Python?

I do not think you will find a way to do this because there is an existing, not yet Under Consideration, ArcGIS Idea to have the 'Field Calculator default to Python'.
PolyGeo's user avatar
  • 65.4k
1 vote

ArcGIS Field Calculator for changeable 3 fields add from table parameter at model builder an...

There is no ArcPy function named GetParameterAsFloat. You will need to use arcpy.GetParameterAsText() (or possibly arcpy.GetParameter()). Using print() statements to show what values have been passe …
PolyGeo's user avatar
  • 65.4k
3 votes
Accepted

Accumulating values of date field using Python parser of ArcGIS Field Calculator?

The way I just did this assumes that you are using a file geodatabase features class, with an OBJECTID field that starts at 1. I've called my date field DateField so change that for yours. Parser: …
PolyGeo's user avatar
  • 65.4k

15 30 50 per page