Questions tagged [python-parser]

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

Filter by
Sorted by
Tagged with
-2
votes
0answers
33 views

How to add values to a field in a attribute table based on some other field in that attribute table? [closed]

I have data for Field under the title "Functional" as "Interstate", "Local" and so on. I have another field (empty) called "Speed". Now if Functional is ...
0
votes
0answers
38 views

Count duplicates in a field for sequential unique ID

I am trying to create a unique ID for my street feature class. (My unique ID starts with first 3 letters of the Street Name, 2 letters of the Street type, and 3 letters of the City Name Abbreviated.) ...
1
vote
1answer
22 views

Using Field Calculator of ArcMap to populate field based on codes from another field

I want to do this basically in the Field Calculator ArcMap using its Python Parser: if !AELEG! == 'L04' !rock_type_age!.replace('Mid-Pleistocene-Holocene volcanic rocks (mainly rhyolite and dacite ...
0
votes
0answers
12 views

Calculating SMR (standardised mortality ratio) in Field Calculator

I'd like to calculate an SMR for the number of disease cases by county. I have in my attribute table [Cases] and [Pop] and should be able to calculate the SMR with this. In R it would be: caseSMR &...
1
vote
2answers
35 views

Split contents of dbase text field into words at “ ”, “-” or “_”, capitalise first letters, and replace “ ” with “_”

A shape file field has text with words separated by blanks " ", dashes "-" and underscores "_". I want to standardise the words to capitalise each word, and then replace ...
0
votes
2answers
37 views

Conditional labeling in ArcMap using Python Parser

I am using ArcMap 10.8. I have 2 attributes: Toponym and Type. Toponym gives the name Type indicates if it is a city, town, church, etc. In English, I would like if Type = town, then capitalize ...
1
vote
1answer
26 views

Creating new variable conditional on another feature using Python Parser of ArcMap Field Calculator

I don't usually work in ArcGIS Desktop or Python. I have a shapefile of road data and the roads have a 'class' feature. I want to categorize the 'Class' feature into just 5 groups and call that ...
0
votes
0answers
30 views

ArcMap polygon labelings

I have a challenge with advanced labels of polygons in ArcMap 10.1. I wish to make the label take the longest direction(either curved, horizontal, vertical or diagonal) inside the polygon. The python ...
2
votes
1answer
92 views

Calculating ratio between “rows” in ArcGIS field calculator

I have a problem similar to Dividing two or more rows in single attribute table? but that is for QGIS whereas I have to perform it in ArcGIS. I have to calculate the Ratio between rows (sequentially, ...
0
votes
0answers
24 views

Changing stacked labels new line character to other than comma using ArcMap

Trying to execute some stacked labels with little bit of Python from the examples given here: https://desktop.arcgis.com/en/arcmap/10.3/map/working-with-text/about-building-label-expressions.htm The ...
1
vote
1answer
39 views

ArcPy expression syntax in CalculateField_management

I am trying create a new column in my shapefile by concatenating a fixed/defined value with the value in another column. I have a syntax error that I can't seem to catch. Below is my code, current ...
0
votes
1answer
16 views

Field Calculator Skipping Statement

I am having trouble with a field calculator statement! I am trying to reclassify an attribute column based on their values. So if value =0 then make it 14, if value < 3 make it 11, if value >3 ...
0
votes
1answer
21 views

Retrieving everything after certain part of column by using field calculator in ArcMap

I have a column in an attribute table and I want to split it with the field-calculator in arcis in a way that I get everything after the 4th blank (space) in a new column: I tried it by using !...
1
vote
1answer
42 views

Calculating only values that are not null in field using ArcGIS Pro

I'm using ArcGIS Pro, the field calculator. I want to populate a hydrant layer with hydrant inspection data. I have two fields from a joined table: field 1 and field 2. I want to populate field 1 ...
1
vote
1answer
34 views

Using field calculator to find fields in row that have same value as reference field then return string gives ERROR 000539

I am trying to create a field "conflict", and the condition is when other fields in that row have the same maximum number the function returns "Yes". I am having trouble making ...
0
votes
0answers
28 views

How to use Field Calculator on 1 to Many Join and keep most recent

I have a Hydrant layer and a hydrant inspection table. So when I join them, it is a one to many join since there are multiple inspections for one hydrant. I need to populate a field in the hydrant ...
1
vote
0answers
32 views

Python label script [closed]

I'm trying to make a label expression using Python (open to using VBscript or Jscript as well) and I just cannot get the result I want... I have 2 columns within my attribute table and I want them ...
1
vote
1answer
28 views

Adding two fields in attribute table and assigning result to third field if some cells contain null values using ArcGIS Pro Field Calculator

I am using ArcGIS Pro, field calculator to add the values of two fields (Result_A and Result_B) and assign the value to new Field Combined_Result. The type for all three fields is "double". ...
6
votes
1answer
109 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?
0
votes
0answers
46 views

Python conditional statement for range of numbers isn't working

Using ArcGIS desktop 10.7. The field Shape_area_Hect is float and the field Core_patch is string. Error for following syntax: def Reclass(Shape_area_Hect): if (Shape_area_Hect >= 12150): ...
6
votes
1answer
115 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 ...
1
vote
1answer
53 views

Re-ordering text strings within field using Python Parser of Field Calculator

At ArcGIS 10.8.1, I have a shapefile attribute table containing a text field with names ordered last, first, middle, as in this example: Smith Sally J Doe John Jones William Randolph ... I need to ...
2
votes
2answers
186 views

Reducing number of if statements in Field Calculator code block of ArcGIS Pro

I am using Python 3 in ArcGIS Pro. In plain English, my goal is calculate one field in a table using a list of values from another field. I can do this with a long list of if statements, but I can't ...
3
votes
2answers
191 views

Expression in arcpy.CalculateField_management

I am working on a toolset, and one of the inputs is a field of a shapefile. I have defined the field and I have used it in multiple functions, and it is working without any error. The problem is that ...
0
votes
2answers
140 views

Extracting numbers and text from string field using Python Parser of ArcMap Field Calculator?

This is a similar question to Extracting numbers from string field using Python Parser of ArcMap Field Calculator? I have a similar issue in ArcMap 10.6. I have a field named 'SIZE' that holds number ...
1
vote
1answer
202 views

Exclude certain values in string field when labelling in ArcGIS Pro [closed]

I am trying to label a field on a map but exclude certain text strings from appearing. Specifically, I am working with pipes and their labels. The string values include the pipe size and material so ...
0
votes
0answers
30 views

Using Python Parser in field calculator to update column from another column

I am an experienced ArcMap user who is fairly new to Python. I am having trouble getting the script to look for a list of values and assign a new label in a new column. The script runs without errors ...
1
vote
3answers
64 views

Using Python if/then codeblock to determine line segment lengths in ArcMap Field Calculator

Can anyone help me create a codeblock using an if/then statement through the Python parser in Field Calculator, to calculate the length of a line segment when the value of a different field is a ...
1
vote
3answers
97 views

ArcPy string concatenation with both forward and back slashes

I am trying to concatenate 2 string variables Var1 and Var2 using python (converting some old ArcGIS VB-based scripts to ArcPy). I need to add a backslash between them. arcpy.CalculateField_management(...
0
votes
0answers
17 views

ArcGIS hyperlink script to assesor maps based on different account numbers

I am adding a hyperlink within the attribution to open up to our local county assessor maps. I am able to get the hyperlink to work directing the user to the map directory to look up based on a given ...
2
votes
2answers
234 views

Python syntax returning only part of the if/elif statement in Field Calculator?

Using ArcGIS 10.7 desktop. I want to reclassify a land use field using Field Calculator. Grasslands are conditionally reclassified using a 'veg_type' field (Avena, or Bromus) and a CWHR land use field ...
0
votes
1answer
30 views

Calculating Min and Max Across fields while skipping Zeros

I am using ArcGIS Desktop 10.5 here. I have a streets layer that has address ranges in the fields FromLeft, ToLeft, FromRight, and ToRight. I am trying to create a street index csv that has the low ...
1
vote
2answers
57 views

Calculating mean value with field calculator for selected records using ArcPy

I want to calculate the mean value in the field z which has Type Zero and write it in Ground field. How can I do that with arcpy? arcpy.MakeFeatureLayer_management(Shapefile, "layer") ...
0
votes
1answer
66 views

Field Calculating using Python Parser with Standard SQL Query Layers & Views in ArcGIS Pro

I have been given the task to extract PASER scores from a comprehensive table of of PASER_byYear. I would like to take the time to create a view and query layers using SQL, but do to time constraints, ...
0
votes
2answers
92 views

ArcGIS Pro Python Field Calculating

I am trying to use Python in ArcGIS Pro to cleanse some data via imported Excel sheets. The expression works, but the Code Block if-else statement to return nothing if !Street_Id! is returns an error....
0
votes
1answer
67 views

Split in ArcGIS 10.8

Working on ArcMap Desktop 10.8; I have a point layer with a field called SITEROAD (string) from which I need to extract ONLY the first word before a space, and put it into a new field, STREETNAME. ...
-1
votes
1answer
149 views

Extracting numbers from string using field calculator of ArcMap [closed]

I need to move number values one field to another field in ArcMap. There's no need to move any alphabetic string vales. Like attached picture shown having number values too so I want those number ...
0
votes
1answer
52 views

ArcMap 10.7 Python Label Expression - compound. expression verified but will not label. Syntax issues

I have road ID labels in a string field that need to be parsed down. I'm using the python advanced label expression. I've removed the preceding '0s' successfully as well as some known text. I need to ...
1
vote
1answer
50 views

Writing Field Calculator codeblock using Python parser of ArcGIS Pro

The following code isn't working as expected and I'm not sure why: UpOrDown = reclass(!UpOrDown!) def reclass (Z,GP): if (GP == "DT" and Z == "CG"): UpOrDown = 1 if (GP == "DT" and Z ==...
2
votes
1answer
193 views

Writing If-Then Statement in ArcGIS Pro Field Calculator Code Block using Python Parser

I have two columns in my shape file with text values called GP and Z which contain abbreviations and a third column called UpOrDown which is meant to hold the binary 0-1 generated from the if-then ...
1
vote
1answer
145 views

Why does Python if/else statement only return else condition when trying to reclassify field using ArcMap field calculator?

Using ArcGIS 10.4. I'm trying to reclassify values from a field (ECOREGION_DIVISION), which is in string format, into new values using the following Python syntax: def Reclass(ECOREGION_DIVISION): ...
0
votes
0answers
34 views

Field calculator - “and” + “or” operators not working in “If/Then” statement

The following Python code I'm trying to use isn't working, and I believe it's due to how I've integrated the "and" and "or" operators. Although I suspect my full code (below) is not ideally written/...
3
votes
1answer
53 views

Field calculator 'if/then' statement, with 'and' not working

I'm trying to do some conditional formatting of an attribute table using Field Calculator. I tried using code below, but am not getting any returns that meet conditions specified (even though the ...
1
vote
1answer
31 views

Using Python to label points with format dependent on date of measurement in ArcMap

I have a database of wells and water level measurements which I would like to label in a stacked manner with the ID on top and the measurement below it. If the measurement is from 2020, it should ...
0
votes
1answer
142 views

Implementing ArcPy codeblocks

I have tried examples from the GIS support website and many more, but I cannot figure out how to get a codeblock for a field calculation to work within ArcPy. Part of my code is underneath, it is a ...
0
votes
1answer
55 views

Calculating Field in ArcGIS Pro ModelBuilder

Trying to setup my first automated mapping project and I need to add a field and then set it to 0. I've tried to use the Calculate Value tool, but I don't have any idea how to actually use this as it ...
-1
votes
1answer
45 views

Extracting specific words from the list of attributes and return all the possible words to a new field with the help of defined dictionaries

I need to extract specific words from the list of attributes and return all the possible words to a new field with the help of defined dictionaries. (using Python Parser in ArcGIS) Example Apples ...
1
vote
1answer
158 views

ERROR 000539: NameError: name 'prevX' is not defined

I'm trying to use the field calculator to input data into a field that I previously created, but it keeps saying that prevX is not defined in line 9. I'm very new to python and I don't really ...
1
vote
2answers
62 views

Combining two simple scripts into single script in Python Parser of Field Calculator

I have two separate scripts used in Field Calculator for an "ID" attribute field. Script 1 is to create sequential numbers for the field. Script 2 is to add leading zeros to the sequential numbers. ...
0
votes
1answer
36 views

Adding Thirty years to date field using ArcGIS Pro Field Calculator

I have 2 fields one is Creation Date the other is Maintenance Date. The Maintenance Date should be 30 years after the Creation date. I have been trying to use the field calculator for this. But I ...

1
2 3 4 5
13