Questions tagged [python-parser]

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

Filter by
Sorted by
Tagged with
4
votes
3answers
4k views

Count the number of characters in a field (Python)

I have a field that contains street names and a second field called COUNT. I need to perform a Python field calculation on the COUNT field that counts the number of characters in the STREET_NAME ...
4
votes
3answers
316 views

Converting full road names to abbreviation using ArcGIS field calculator?

I have a data table with a column 'names' that have street names with street type (Road, Lane, Street etc.). I need to get the names in a format like in column 'new_names'using field calculator in ...
4
votes
4answers
9k views

Concatenating string data plus numeric data in ArcMap field calculator?

I am using ArcMap 10.2.2. I have three attribute fields (Address_No: 1, StreetName: Main, Street_Ty: ST) that I want to merge together. How do I concatenate string data found within the table plus ...
4
votes
3answers
9k views

Extract string between special characters - and / into a new field ArcGIS Field Calculator

Can I create a field calc expression in ArcGIS 10.3 to print a selection between special characters? I would like to extract a selection of string from field [FolderPath] to a new field [Name]. The ...
4
votes
2answers
16k views

Replacing NULL value with Zero in geodatabase table using Python parser of ArcGIS field calculator?

I am having some difficulties to change "NULL" values to zero in geodatabase. I have tried the following python code in ArcGIS 10.1 ("Field Calculator") to change it but did not work. Pre-Logic ...
4
votes
3answers
301 views

Using IF operator with Python parser of ArcGIS Field Calculator?

I want to assign numbers to a certain types of building and I need to use field calculator. I tried many different versions of this and I still can't find what's wrong. Could you tell me where do I ...
4
votes
2answers
2k views

Writing If-Then Statement in ArcGIS Field Calculator using Python Parser?

Scenario: I have four fields: A, B, C and D Field A is text-based and contains values from '000' up to some number 'xxx' Field B contains a set of values (also text, but represented by numbers) ...
4
votes
2answers
11k views

Using conditional statements in ArcGIS Field Calculator?

I have two fields, "P_Area" and "PC_Area", whose sizes I'd like to compare in a third field, "Areas_Equal". The "Areas_Equal" field should contain a "Yes" if the other two are equal and a "No" if they ...
4
votes
1answer
163 views

Reclassifying Vector Field using python parser in field calculator

I am attempting to reclassify a field in ArcMap using python within field calculator. Below is screenshot of how it is set up. when I run the reclassify I get an error, and my prepossessing results ...
4
votes
1answer
2k views

Calculate Field using variable in arcpy

I've got a problem with my script and hope that someone can help me. What I´d like to do is using the field calculator to calculate values for a field using values from another field and a variable ...
4
votes
1answer
535 views

Using ArcGIS Field Calculator to populate number field from text field?

I'm trying to assign speed values to street types using TIGER street shapefiles. So I created the new field for the speed, and I was going to use the field calculator to take the MTFCC classifications ...
4
votes
2answers
501 views

Concatenating two fields (type double) into single field?

In ArcGIS 10.3 using the field calculator, I'm trying to concatenate a census tract field (double) with a census block field (double) into a single field that has the two values separated by a decimal ...
4
votes
2answers
2k views

Counting Characters using Field Calculator - ArcMap

I am trying to use field calculator to populate a column based on the the number of characters in another column. I am using the Python Parser. I am not sure if the .count() function is appropriate in ...
4
votes
2answers
244 views

Updating new field from existing field using ArcGIS Desktop?

I need to update my new field/column (Property Type) with either "detached", "semi", or "terrace" depending on an existing column (Property Count): where the count = 1 I need to populate Property ...
4
votes
2answers
336 views

Python script in ArcMap Field Calculator giving Error 000539: SyntaxError: Invalid Syntax?

I've been trying to calculate this expression for a field in an attribute table in ArcMap 10.4.1, and keep getting the following error: Error 000539: SyntaxError: invalid syntax (expression, line ...
4
votes
2answers
620 views

Script (ArcPy) vs field calculator (Python Parser) behaviour of getPart in ArcGIS for Desktop?

From time to time I have to access geometry field and shuffle through points in it. Process is simple: Get shape Get it's part Iterate through part's points This is how it looks like in a script ...
4
votes
2answers
970 views

Assign field values (double) based on values of other field (string) using field calculator

I want to assign numbers to a field, WScore (double), based on field values of Soils (string). They are in the same table of a raster. I'm not trying to add text to a double. What I want to do is this:...
4
votes
2answers
8k views

Using nested if statements in Python Parser of ArcGIS Field Calculator?

The solution in VB for the base process is at If/then VBScript/Python code equivalent to SQL IN ('x','y',z') expression in ArcGIS Field Calculator? works great but I was trying to ...
4
votes
2answers
3k views

Populating field with max M value of feature using Python in ArcGIS Field Calculator?

I need to calculate the max M value for a line feature using Python in ArcGIS 10 Field Calculator but I cannot figure it out. In 9.3 I used the follow VBA expression… **Pre-Logic VBA Script Code:** ...
4
votes
1answer
167 views

field calculator python script with coded values

I am trying to run a field calculator python script that will take a value from one field in the attributes table and create an abbreviation in another field that was designated for it. Here is a ...
4
votes
2answers
585 views

ERROR 000539: Error running expression

I am trying to calculate my End_Streets field within two joined tables. I want to remove the redundant SECONDARYN value from the STREETS field. " & ".join(!IntersectAndEnds2.Streets!.split(" &...
4
votes
4answers
6k views

Concatenating numbers and adding in leading zeros?

I have three text fields populated as follows: 1, 9, 1 that I need to concatenate into a field that looks like 01.09.01. Getting to 1.9.1 is easy but can anyone help out with how to formulate it so ...
4
votes
1answer
973 views

Automatically calculate field with every new entry?

I have a point feature class that has a "Direction" field (north, northwest, west, etc; linked to a domain with 16 options). I then have a numeric field "Rotation" that controls the rotation of the ...
4
votes
2answers
1k views

Controlling label/attributes of grid/fishnet index using ArcGIS for Desktop and ArcPy?

I have used the Grid index feature tool to create an index grid. The label/attribution of the page names are populated in a "row" orientated manner. eg lef to right a1,a2,a3,a4,a5,a6 b1,b2,b3,b4,b5,b6 ...
4
votes
3answers
1k views

ArcGIS Field Calculator Python numbering rows of fishnet

I have a grid of 100*100 cells. I want to add to each cell a number representing the row it is in (like in excel). I added a field and want try to solve that with field calculator: The code is ...
4
votes
1answer
115 views

Writing Labeling Expression for ArcMap?

How can I remove the alphabets and show the numbers only in a label expression of a layer? For example, I have a field with values: TK209, 01TKRW394, 045TK, 089EYZ46 and I want to display labels as: ...
4
votes
1answer
185 views

Field Calculator - use a string field to determine how a calculation is applied to a numeric field

I have a String field ('Prefix') and a Double field ('Result'). I am trying to group data by a specific range, <0.002, 0.002 to 0.07, >0.07, however some values have a '<' or '>' prefix ...
4
votes
1answer
81 views

Recalculate a Field with data from another field, ignoring NULL values

I have a Feature Class in a Geodatabase with an field for pipe diameter. I also have a shapefile with a field for diameter. The shapefile is from field verification work that verified a variety of ...
4
votes
1answer
103 views

Date Formatting Mess

I am trying to format a date field that underwent incorrect importation. The result was that the date format became coded in a way i am unsure of. Is there a simple way using the field calculator ...
4
votes
1answer
109 views

Using UNC pathname with Calculate Field tool in ArcPy?

This question is different to Using Calculate Field to fix hyperlinks in ArcPy gives Cannot use VB for services? which was asked previously because it is using the Python parser specifically, rather ...
4
votes
2answers
503 views

Populating string field based on numeric value from numeric field in ArcGIS Field Calculator?

I am new to Python and I'm trying to write a simple if then statement in Field Calculator in ArcGIS 10.2.2 that will take the values from a numeric field and add them to a string field. I can't ...
4
votes
2answers
139 views

Giving polygons classificaton code in ArcGIS Desktop?

Does anyone have a trick for assigning polygons a code based on the classification classes? For example, if I symbolize the population of census blocks with 10 classes using Natural Breaks, I would ...
4
votes
1answer
2k views

Python syntax error from raster calculator in ArcGIS ModelBuilder?

I am experiencing a problem with the raster calculator in the ModelBuilder under ArcMap 10. I need to combine two layers: a drainage map (issued from a series of previous operations on a DEM) and ...
4
votes
2answers
758 views

How do I use Python to edit a field in an attribute table?

I have a few data tables full of information on salt water injection wells, with injection volumes given on a monthly basis. I need to add these monthly values up in order to get an annual value for ...
4
votes
1answer
739 views

Using Python strip and split functions in ArcGIS Field Calculator?

I am trying to populate a field with the last word in an address string using field calculator within ModelBuilder. My code takes the whole address string (1234 S Brittany Town Dr) as a parameter, ...
3
votes
4answers
253 views

Removing first and third zeros of a fieldname in label expression

The fieldname only has three characters. I dont want to display zeros in the first and third values. example below. 010 = 1 100 = 10 01Y = 1Y 10Y = 10Y I have figured out how to strip out zeros ...
3
votes
2answers
6k views

Generate random floating value

I need to generate random floating numbers between 0 and 1 in the field of attribute table for ArcGIS 10.3 version.
3
votes
3answers
12k views

Calculating incidence angle of polyline?

How can I calculate the angle of each polyline in ArcGIS?
3
votes
3answers
472 views

Returning shape.area in code block of ArcGIS Field Calculator with if statement?

Using ArcGIS 10.1 for Desktop, I try to calculate a field using an 'if' statement in the field calculator. Here is my code : " #Expression MyField_2 = def Reclass(!MyField_1!) #Parser Python 9.3 #...
3
votes
2answers
423 views

Label expression in ArcGIS gives TypeError coercing to Unicode need string or buffer NoneType found?

I try to build stacked label expression in ArcGis 10.3.1 with this expression: [name3] + '\n'+ [results] name3 and results are two columns in the attribute table. But I get this error: ...
3
votes
2answers
841 views

SyntaxError from Python Label Expression in ArcMap?

I am trying to use a find label expression that changes the font of one field, [NUMBERNAME]. I am using the Python parser of ArcGIS 10.3.1 for Desktop. All fields have a data type of text. This is ...
3
votes
3answers
3k views

Problem with arcpy.CalculateField_management

I have a table with a column named "Kategorie", filled with values. I added a new column named "RULE". I want to fill this column with Strings depending on "KATEGORIE". I have a PY-Script and it doesn'...
3
votes
1answer
5k views

Receiving error 000539 from CalculateField_management?

I am trying to add (ie "Author", "LastUpdated") to feature classes within a gdb and then populate each of those fields. I have been able to get my code to run properly for the numerical field but I ...
3
votes
1answer
191 views

Referring to Null value with ArcPy Expressions?

How do I refer to Null values in a field using an expression in Python? I've tried using the following as well as = None and =Null but nothing has worked yet: ScoreCondition = "Cond_Score(!"+...
3
votes
2answers
210 views

Extracting substring from field in ArcMap using Python Parser of Field Calculator?

I have some parcel data where I need to extract a subdivision name from a long string. The format is always "Subdivision: ____ ______ _____" etc. BUT, there is no uniformity to what comes before or ...
3
votes
2answers
363 views

Automating Select By Attributes and Calculate Field?

I have zero experience with python and very little experience with ModelBuilder in ArcGIS. I have a shapefile with two fields, let's say their names are "Function" and "Regulation". What I need to do ...
3
votes
1answer
654 views

Calculating field with hour from date time field with ArcPy?

This expression works in the field calculator to give me the hour from the datetime field called dtrepor arcpy.time.ParseDateTimeString(!dtrepor!).strftime('%H') But how do I call it in python? I ...
3
votes
2answers
246 views

Using Calculate Field for If statement over many fields?

I'm struggling with the python syntax in the Calculate Field so that, in the table above: if b, c, d, or e are NOT NULL populate the Summary field with "Verified" else populate Summary field with "In ...
3
votes
1answer
921 views

Python Max Function in Field Calculator for Date values

I have 4 fields with Date Time values, and created a new field (Date type as well) which takes the most recent date from these 4 fields. I have tried using the Max python in the field calculator to ...
3
votes
2answers
240 views

Populating Attribute field using Python code without copying over null rows?

I am trying to copy the values from one column within my attribute table (!roomName!) over to another column (!spaceDiscriminator!). I understand how to do an easy field calc over for all the values ...