Skip to main content

Questions tagged [python-parser]

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

Filter by
Sorted by
Tagged with
19 votes
3 answers
108k views

Basic If/Then in Python Parser of ArcGIS Field Calculator?

I am using ArcGIS 10.2 for Desktop, and I've been looking through this site, and can't seem to figure out my answer yet. Very new to VBA and Python, but lots of years with ArcGIS. I know I can do ...
BenW's user avatar
  • 623
18 votes
3 answers
40k views

Rounding column in attribute table using ArcGIS Field Calculator?

I want to use the Field Calculator in ArcMap to round an existing column to two decimals. Currently I have a column that is 6 decimal places long and would like to simply round it down to 2 decimals. ...
jsmith's user avatar
  • 741
16 votes
7 answers
11k views

Find/Replace Double Quotes using Python Parser of ArcGIS Field Calculator?

I'm trying to use the Field Calculator (ArcMap 10.0) to strip out double quotes in an address field (I didn't put them in there, believe me). I've tried many incantations but am still unable to even ...
Random Geo guy's user avatar
14 votes
8 answers
59k views

Removing return/newline (\n) character from Field using Python and Field Calculator?

I have a geodatabase table with a field that I'm trying to remove return characters (new line). I found this post (How can I remove (chomp) a newline in Python?) of how to do it, however it is not ...
artwork21's user avatar
  • 35.1k
13 votes
3 answers
19k views

Calculating sequential numbers into sorted table using ArcMap

I am using ArcMap 10.3. Is there a way to calculate a sorted field with sequential numbers in the Field Calculator or using an Update Cursor in ArcPy? I have seen Sorting feature class to calculate ...
Midavalo's user avatar
  • 29.8k
13 votes
1 answer
4k views

Auto incrementing field based on groups within feature class?

I am needing to auto increment a field based on groups within a feature class. I have 8 plots within a given polygon and I need to assign them an ID from 1-8 for each set of plots within each polygon. ...
Becks's user avatar
  • 133
12 votes
2 answers
1k views

Computing new attribute based on changes in another attribute using ArcGIS Desktop with Python?

I am attempting to classify a set of gps time-encoded point data into behaviors based on different attributes. I have created an attribute that is 0 for home and 1 for away based on location, and ...
AlmaThom's user avatar
  • 844
12 votes
2 answers
14k views

Converting from DMS to DD using Python in Field Calculator?

I need to convert lat/long that is expressed as degrees, minutes, and seconds in the data into decimal degrees. For example, in the data, they are listed as N335042.06 in the Latitude column, and ...
kaoscify's user avatar
  • 981
10 votes
4 answers
3k views

Need to find strings that contain the same word twice

I have attribute data with owner names. I need to select data that contains the last name twice. For example, I may have an owner name that reads "BENNETT MCCARL & ARNETTE BENNETT". I would like ...
Kristen's user avatar
  • 203
9 votes
4 answers
8k views

Removing numeric characters from alphanumeric value in field calculation?

I have a field containing alphanumeric values in the following format: A-AA00 Sometimes they are also A-AAA0 I need a Python script I can put in the field calculator in ArcMap 10 that will at ...
ndthl's user avatar
  • 449
9 votes
2 answers
21k views

Sorting feature class to calculate sequential ID field using ArcGIS Field Calculator?

I am in ArcMap and I want to sort the records based on a field and then do a Calculate Field with an auto-incrementing value with the sort in-place. Any ideas? It looks like I could get an update ...
Justin's user avatar
  • 3,398
8 votes
2 answers
6k views

Troubleshooting ERROR 000989 Python syntax error from ArcGIS Field Calculator?

I'm trying to used the Python syntax in ArcGIS 10's field calculator and am thoroughly confused. So far the most basic calculations are failing me, and I don't understand why. I'm trying to create a ...
djq's user avatar
  • 16.3k
8 votes
3 answers
24k views

Auto-incrementing field in feature class using ArcGIS Desktop?

So I'm relatively new to ArcGIS and ArcCatalog. I have created a field name of PROJECTID in a feature class in a Personal Geodatabase. The data type is TEXT. This will be a ten digit ID. The first ...
yams's user avatar
  • 307
8 votes
2 answers
1k views

Changing default parser in ArcGIS Field Calculator to Python?

Is there a way to change the default parser in the Field Calculator to Python? So annoying to always change now that I'm trying to move away from using VBScript... I'm using ArcGIS 10.1 for ...
Jason Miller's user avatar
  • 1,460
8 votes
2 answers
1k views

Performing multiple calculations in ArcGIS Attribute Table?

I have an existing Excel spreadsheet developed to track specific fire hydrant data, this is periodically updated and joined to the spatial hydrant data in ArcGIS. In the spreadsheet there is a number ...
LandArch's user avatar
  • 2,201
7 votes
3 answers
6k views

Doing If/Then over multiple data columns in Python Parser of ArcGIS Field Calculator?

I have some VB code saved that looks at two columns of data, and populates a third with the low value. Pre-logic Script Code: Dim output as double if [MIN_LEFT] < [MIN_RIGHT] Then output = [...
Leslie's user avatar
  • 73
7 votes
2 answers
3k views

Fnding wildcard string using Field Calculator script code?

I'm trying to find part of a text string in the CLASS_NAME field and return a text string to the Abrv_Name field using the Field Calculator in ArcGIS 10 via a Python parser. Here is what I have tried ...
user6784's user avatar
  • 529
7 votes
1 answer
13k views

Meaning of exclamation mark in Python parser of ArcGIS Field Calculator?

In the following line, I don't understand what those exclamation marks mean? And why put everything in quotation? I don't understand the purpose of the variable expression, please explain to me as I'm ...
Solaire's user avatar
  • 151
7 votes
3 answers
8k views

Calculating Field based on name of shapefile

I have multiple shapefiles to which I have added a field called "gname1". For each shapefile, I want "gname1" to be set to the name of that particular shapefile, for every feature within the shapefile....
Jessica's user avatar
  • 71
7 votes
3 answers
5k views

Removing multiple characters from string field using Field Calculator Python Parser?

Is it possible to remove more than 1 character from a string in a field using the field calculator? I know !file!.replace(" ","") removes spaces in a string, but is it possible to remove spaces and ...
coffee and gis's user avatar
7 votes
4 answers
1k views

Parsing serial date in ArcGIS Desktop?

I have imported a shapefile that contains a serial date number that looks like this: 41256.260799. I would like to create a new field that shows only the hour and second like this: 06:33. I've tried ...
Gord's user avatar
  • 71
7 votes
1 answer
15k views

Adding automated values to attribute field?

I have parcel and buildings layers. In their attribute tables I want to replace "NULL" values with numbers from 1 to 2000, in "Parcel ID", or "Building ID" field. How can I do this in ArcGIS ...
GIS Man's user avatar
  • 1,123
7 votes
1 answer
5k views

Using Range in Python expression of ArcGIS Field Calculator?

what is the python expression for defining a range of numbers? I have tried numerous combinations but cannot get a simple range of angles (100 -200) to compute correctly. Screen shot :
sirgeo's user avatar
  • 2,039
7 votes
1 answer
3k views

Summing Attributes from a Related Table?

I have a line feature class representing road segments, with each road segment having a unique ID. This feature class has an attribute of average observed daily traffic counts. I have another table ...
nmpeterson's user avatar
  • 8,306
7 votes
1 answer
3k views

ArcMap Field Calculator syntax (again)

I'm trying to string together a field calculator script that will populate all the records of a field at once based upon values in a number of fields. I can't even get the first part of the command ...
phyllo's user avatar
  • 181
6 votes
1 answer
17k views

Deleting first two letters from string field usimng Python Parser of ArcGIS Field Calculator?

I'm looking for a field calculator Python statement to delete only the first two letters of string entries. For Ex: !Name!.strip([0:2]) I know this syntax is incorrect.
tdr's user avatar
  • 247
6 votes
5 answers
23k views

Normalizing raster using raster calculator in ArcGIS 10.3.1? [duplicate]

I have been trying to 'range standardise' or normalise my raster values from 0-100 and I know how to do this mathematically: ("raster"-min("raster"))/(max("raster")-min("raster"))*100 and I have ...
tda's user avatar
  • 531
6 votes
1 answer
5k views

Writing Python code block in field calculator?

I am a novice in Python as well has having minimal experience with ArcMap. Currently I am using a U.S. Census TIGER file, mapping roads in Harris County, TX. I want to add a new field called SPEED, ...
DPek's user avatar
  • 105
6 votes
1 answer
41k views

Writing conditional (if/then) statements into ArcGIS Field Calculator using Python Parser?

I have gotten stuck on seemingly simple ArcGIS field calculator python expression. I obtained a great answer to a another similar question a few years ago: Using Range in Python expression of ArcGIS ...
sirgeo's user avatar
  • 2,039
6 votes
1 answer
10k views

Converting state name abbreviations to full names using ArcGIS Field Calculator?

I have a data table with columns that includes city names (ex: San Jose) and state name abbreviations (ex: CA). Is there a way to define the state names as their full names (i.e., CA = California) and ...
kaoscify's user avatar
  • 981
6 votes
3 answers
4k views

Using degree symbol in Label Expressions of ArcMap? [closed]

I am trying to use the labeling process to display latitude and longitudes for a set of data points. To make the labels appear formal, I wish to add the degree symbol (°) to the labels. My python ...
Natedawg5509's user avatar
6 votes
2 answers
215 views

ArcMap sometimes ignores labeling expression

I'm using this python script as an expression for labeling in ArcMap: def FindLabel ( [volkorrekt] ): if [volkorrekt] >= '5': return "<FNT size = '20'>"+ str( [volkorrekt] )+&...
Simon's user avatar
  • 621
6 votes
6 answers
2k views

Using ArcMap Field Calculator to set Row 1 (Column D)= Row2 (Column B)?

This is probably a fairly basic question but I have a long list of latitude and longitude values that represent telemetry points that will be the start point of the line. Before I convert them to ...
S. Burke's user avatar
  • 139
6 votes
1 answer
598 views

Creating Unique IDs of points in order from west to east

I have a dataset with over 1000s points. I am wondering if I am able to give each point a unique ID starting from west to east. I am using ArcMap 10.6. Is there a way to do this in ArcMap?
user avatar
6 votes
2 answers
26k views

Splitting string in Python parser of ArcGIS Field Calculator?

I am trying to use Python to split a string field into three new fields at the separator " - ". The field is in the format "a - b - c". So I initially had this in the field calculator for newFieldA: !...
Cindy Jayakumar's user avatar
6 votes
2 answers
970 views

FindLabel not Defined in ArcMap labeling with Python Parser?

I'm trying to make an advanced label expression using the python parser and I keep getting the following error: The expression contains an error. Modify the expression and try again. Error 0 on ...
Mike's user avatar
  • 2,281
6 votes
1 answer
957 views

Classifying time periods in new field using Python Parser of ArcGIS Desktop?

I have a datetime field (Horario) in my feature class, showing only the time. Although the date doesn't appear, it seem to be stored automatically as 30 Dec 1899, I'm not sure why. I want to use ...
Beatriz Viseu's user avatar
6 votes
1 answer
781 views

Defining a Python function to calculate a value using multiple fields

I am using the Calculate Field tool in ArcGIS Pro to get it to calculate fire hydrant flow data. I need data from the table fields PitotPressure, COE, and HydrantOrificeFlowed in an attribute table to ...
532's user avatar
  • 61
6 votes
1 answer
265 views

Update Cursor skipping last row?

I have created a python function within field calculator to calculate the time difference between a timestamp (yyyy-MM-dd HH:mm:ss) in a row and the row after (the interval field in seconds). I have ...
Will's user avatar
  • 151
6 votes
2 answers
5k views

Performing advanced labeling using Python in ArcMap?

I am attempting to write a Python label expression that would involve multiple label definitions. Here is what I am trying to do using ArcMap 10.1. I have a point shapefile representing Monitoring ...
ACrain's user avatar
  • 103
6 votes
1 answer
2k views

Python Labeling using dictionary not printing all values

I am labeling manhole inverts using python and ArcMap 10.3. When I use a dictionary to control the label order some manholes don't print all of the inverts while other manholes do. I can post field ...
Barrett's user avatar
  • 3,079
5 votes
3 answers
21k views

Calculating incidence angle of polyline using ArcMap

How can I calculate the angle of each polyline in ArcMap?
John Agbo Ogbodo's user avatar
5 votes
2 answers
368 views

Field calculating a unique date and time

I want to field calculate a field to be have a have the date and time (down to the second) and two letters after (to be assigned by user). For example, if the record was created on September 8th, ...
Elizabeth's user avatar
5 votes
1 answer
658 views

Translate Excel formula to be used in field calculator

I have a series of equations to create corner points to make rotated polygons based on angles in the attribute table, but I have created it in excel and can't figure out the syntax to get it to work ...
katzendoodle's user avatar
5 votes
2 answers
7k views

If/then VBScript/Python code equivalent to SQL IN ('x','y',z') expression in ArcGIS Field Calculator?

we need just like the following, only with multiple records selected... have tried the "xyz" in (1,2,3,4,5) SQL code but of course VB Script wants something else. dim f2 if [field1] = "foo" then f2 ...
sirgeo's user avatar
  • 2,039
5 votes
1 answer
223 views

Stacked Label using If/Else in a Label Expression

I have a large set of data with lab results that I'm looking to label in ArcMap. I'm trying to build a label expression that needs to produce a label that essentially needs to look like this: B=5 T=...
Tom's user avatar
  • 103
5 votes
4 answers
7k 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 ...
Denyce's user avatar
  • 51
5 votes
1 answer
785 views

Calculating Polsby-Popper Score Using ArcGIS Pro Field Calculator gives ERROR 000539?

This operation is using the Field Calculator in ArcGIS Pro 2.1. I am trying to calculate the Polsby-Popper Score for Congressional Districts. I have calculated the Geodesic Area and Geodesic ...
SteveC's user avatar
  • 745
5 votes
1 answer
1k views

Counting number of times value/string occures in field using ArcGIS field calculator?

How do I count the number of times a value/string etc. occures in a field (using field calculator)? In my example I want to count the number of times the letter "H" occures in a field; see attached ...
gobrandal's user avatar
  • 183
5 votes
1 answer
134 views

Field Calculator text field to new shapefile

I have point features being selected by a polygon feature and copied to their own shapefile. I also have certain values of the polygon feature being applied to the newly created point file. The ...
IFR_Inverted's user avatar

1
2 3 4 5
14