Questions tagged [python-parser]

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

Filter by
Sorted by
Tagged with
0 votes
2 answers
62 views

Populate NULL from existing value from another record

I'm using ArcGIS Pro on the table below (ACCT_ID field is sorted). The goal is to calculate/populate the "Asset" field where if rows have the same "ACCT_ID" and at least one of ...
user avatar
  • 721
0 votes
1 answer
26 views

I need label expression in python to stack labels for points present at same geometry

I have a data set that has stacked points. I need to display the labels as one. The dataset has locations that only have 1 point and some that have 2 or 3 stacked points. I’d also like to be able to ...
user avatar
2 votes
1 answer
44 views

ArcMap - Date field

I am trying to append some data to an existing enterprise geodatabase feature class, the data I am trying to append has a date field where some entries are in correct, eg instead of 03/19/1983 they ...
user avatar
1 vote
1 answer
36 views

Selecting attributes for field calculator by common name

I am trying to automate some of my GIS processes and have come across a snag in my automation. I am trying to understand the percent coverage of my suitability raster layer with my town boundaries ...
user avatar
  • 33
2 votes
0 answers
49 views

Combining labels for multiple points in ArcMap

I have a data set that has stacked points. I need to display the labels as one. I've seen this solution Can labels for overlapping points be combined/merged into one label? but it only works for a ...
user avatar
  • 21
0 votes
0 answers
36 views

ArcGIS Field Calculator: Sequential Numbers [duplicate]

I am attempting to populate a field with sequential numbers using Python or arcade but need to duplicate the sequential number created if values match in Field A. The below snippet obviously creates ...
user avatar
0 votes
0 answers
27 views

ArcGIS Pro If / Else Python Labeling Expression - Formatting

I'm using ArcGIS Pro and am trying to recreate this label expression using formatting rather than concatenating, as I've read it is more efficient / faster. I can't seem to wrap my head around how to ...
user avatar
1 vote
0 answers
33 views

ArcGIS Pro field calculator based on values code [closed]

I'm trying to calculate a field to produce symbol codes for GPS units based on a field "Grade". I've tried cobbling together the code based on samples I found; but got syntax error. The Code:...
user avatar
  • 11
2 votes
1 answer
38 views

Amalgamating zip codes using Python Parser of ArcGIS Pro Field Calculator

I'm fairly new to Python and I'm trying to amalgamate the zip codes from the fields of !OWADR2!, !OWADR3!, and !OWADR4! into a new field I've created. Basically I want to make a block of code in the ...
user avatar
1 vote
0 answers
64 views

Conditionally skip field calculation for certain rows

Regarding the field calculator in the ArcGIS Pro 2.9 attribute table (Python): Is there a way to skip calculating a certain record, if certain conditions are met in the script? For example, if the ...
user avatar
  • 756
1 vote
0 answers
22 views

Populate/reclassify newly created field with values dependent on an existing field

I'm trying to populate/reclassify a newly created field with values dependent on an existing field. The new and exiting field has text data type. Here is the code that I'm using. The existing field is ...
user avatar
  • 11
2 votes
3 answers
74 views

Calculate Sequential Values based on Boolean field

I am trying to calculate sequential ID Values (SeqID) based on Boolean field (Boolean) along several rows in attribute table through the field calculator of ArcGIS Pro, Python, (expression and ...
user avatar
2 votes
1 answer
61 views

Finding duplicate attributes and selecting one to delete based on another column

I have a very large polygon attribute table with multiple pairs of duplicate superimposed polygons, whose areas are identical. There is also another column which indicates the years these polygons ...
user avatar
2 votes
1 answer
31 views

Assigning different classes using ArcGIS Field Calculator

Below is the code with what I have come up with. I have two columns, one named First_kopp that have the classes CT, WT, ST ranging from 1-9, and the second column is named First-fros. There are ...
user avatar
0 votes
1 answer
40 views

Field Calculator Python code error - "Parameters are not valid"

I am trying to create a new column that combines the values of two other columns for display purposes. Here is the code that I am trying: "Pre-Logic Script Code" window: def reclass( !...
user avatar
-2 votes
1 answer
64 views

Writing IF THEN string calculation in ArcGIS Pro [closed]

I am attempting to calculate a text field in my attribute table based on a number code given in a different column For example, any number under the "LU_1" column that is '510' will be ...
user avatar
3 votes
1 answer
130 views

Field Calculator function caused all my rows to become Null

Had a field that had some categories that didnt make sense to be listed alphabetically so wanted to add a preceding number to the text so they would be in the order I wanted. Ran it once and it worked ...
user avatar
  • 61
-2 votes
1 answer
49 views

Separating characters using Python Parser of Field Calculator in ArcMap [closed]

How can I separate the characters of a string, for example, three by three with slash letters or dashes and insert them in the Attribute table in ArcMap? abc-def-gh a100-b200-c300
user avatar
  • 1
2 votes
2 answers
65 views

Removing characters using field calculator in ArcMap

I am working with automating a workflow using ArcGIS ModelBuilder, and the final output returned an error in the resulting output. Here the Test field is filled by adding a Prefix "City of" ...
user avatar
0 votes
0 answers
72 views

Syntax for Field Calculator in ModelBuilder of ArcGIS Pro

I'm migrating a legacy ModelBuilder tool that has a VB code block in it to ArcGIS Pro 2.9. It's a straightforward issue: The model runs a Calculate Field process. If the field is not null, do nothing,...
user avatar
  • 107
1 vote
1 answer
72 views

Replacing text in label through expression in ArcMap

I am using ArcMap. In the labels I want to alter the text that is displayed, I do not want to change the data in the attribute table. In the label expression I add the following after checking the ...
user avatar
0 votes
0 answers
30 views

ArcMap Field Calculator Expression for Highest Value + 1

I'm looking for a VB or Python field calculator expression in ArcMap that will calculate the Highest Value + 1 into the same field named Corr_ID. I was thinking something as simple as this max(!...
user avatar
  • 273
0 votes
0 answers
42 views

ArcGIS Pro Python Labelling Expression does not update labels

I am trying to alter the size of labels around a point layer using a python if/elif expression. The expression is valid but nothing changes when I apply the expression. Below I have included the code ...
user avatar
  • 1
2 votes
1 answer
35 views

Why does = not seem to be working in script?

Below is the script I am working with. However, I get N/A for values which should have a statement as the output. I have added the screenshot showing the N/A that the script produces instead of the ...
user avatar
0 votes
0 answers
39 views

Why does script output blanks at certain rows?

I have been trying to run a script, which runs successfully. However, when using the select by attribute tool and choosing get unique values, I have noticed there are certain rows that do not produce ...
user avatar
2 votes
1 answer
189 views

Calculate Field: Remove last character in string based on condition

I have a list of route numbers in a geodatabase that contain directions on the end of them (123W, 123E, 1500S, etc.). I need to remove the last digit if it is N,S,W,E but leave other letters. I'm very ...
user avatar
  • 29
0 votes
1 answer
38 views

Returning existing field words using ArcGIS field calculator

I need to write a script. The image below shows the data that I am working with. I would like to add the data from the field Frost_Corr for the remaining fields in SubTrp_Cor. For example where it ...
user avatar
0 votes
1 answer
43 views

Field calculation using Python Parser

I have a table as like below: I want to generate python script to calculate the value Low, Medium and High into a single layer. I tried using this script: Parser: Python Expression: Reclass( ...
user avatar
0 votes
1 answer
76 views

Math functions in ArcMap field calculator

I would like to calculate the mean and the Standard Deviation as part of a script Pre-Logic script Code: def z_score(val, mu, sigma, inc=10.0, cat=10): return (0 if val < mu else min(cat, ...
user avatar
  • 19
0 votes
0 answers
71 views

Using Python function In Field calculator of ArcGIS Desktop

I am trying to run this expression in Field calculator to create symbology values for a point shapefile The script below is not doing what I want. The script needs to calculate the mean and the ...
user avatar
  • 19
2 votes
1 answer
63 views

ArcGIS Python query syntax

I am struggling with running a simple piece of code using Python in ArcGIS field calculator. I suspect it could be a very simple error and need an extra set of eyes. For summer months (Dec-Feb) and ...
user avatar
0 votes
2 answers
58 views

Writing python script with field calculation

I need help with field calculations for more than 20 fields. I have to do this task on joined table. I used CalculateField tool in ModelBuilder. Is there a way to call all 20 fields in the tool and ...
user avatar
  • 1
-2 votes
1 answer
68 views

If statement errors in ArcMap [closed]

I wrote a rather complex code but something doesn't seem correct. It returns error executing function. Can you fix my code? def reclass(siteclass,tempzone,rainzone): if 'ST' in siteclass and '...
user avatar
2 votes
1 answer
35 views

IF statements to rank different ranges with field calculator in ArcMap

I have a simple calculation to perform using the Python Parser in ArcMap but am running into some trouble when it comes to coding the ranges of values. I have three different fields: mean temperature, ...
user avatar
1 vote
1 answer
60 views

ArcGIS Field Calculator using Python Parser gives ERROR 000989 [closed]

I am attempting to learn how to update a field using Python with Codeblock showing. The script is supposed to return a value to a text field based on a numerical value in two float fields but I keep ...
user avatar
  • 45
0 votes
1 answer
153 views

Writing Python Labeling Expression with If / Else using ArcGIS Pro

I'm using ArcGIS Pro and am trying to create a label expression. I need the fields without data (NULL) to only say Name. Otherwise, I need it to say the name and the mounding data below it. This is my ...
user avatar
2 votes
2 answers
84 views

Moving cells with field calculator of ArcGIS Pro

I am trying to move field entries down by 1 in an attribute table, between a certain row spread. I would like to move all the entries in the 'key biomechanical features' column down by 1 row between ...
user avatar
0 votes
0 answers
26 views

Getting invalid syntax in Python Parser of labeling in ArcGIS Pro

I am writing a Python expression in order to label gravity mains based on their attributes. I will provide screenshots of the specific error and my attribute table's field settings for reference. def ...
user avatar
4 votes
2 answers
76 views

Iterate multiple soil fields through Calculate Field

I understand this can easily be done manually using Calculate Field, however I'm looking to automate this process using ModelBuilder as it is a requirement of the current module. I have 7 Weather ...
user avatar
1 vote
0 answers
64 views

ArcGIS pre-logic script code does not work

I am trying to define a function in pre-logic script code on ArcGIS 10.8. While running it, it shows the failure. I am not able to figure out the reason behind it. I have defined the following ...
user avatar
  • 291
0 votes
0 answers
34 views

How to replace a word using python parser in ArcGIS

I have the names like below Rua Jose Rovira Travessa Jose Rovira Rua Antônio de Jose Belém I need to replace the name José where the Jose. I'm trying this: !field!.replace("Jose","...
user avatar
1 vote
1 answer
43 views

Calculation in attribute table field - ArcGIS Desktop 10.5

I'm new to the Python language, and I need to add an "L-" character in the highlighted 'Teste' field in ArcGIS. I tried the replace function, but it didn't work. How do I do that? example: I ...
user avatar
  • 21
3 votes
1 answer
33 views

Automating date creation in field calculator

I am trying to calculate a reinspection date for surveys using the field calculator in ArcGIS Pro. I am using a predefined survey date and risk zone for this calculation. The risk zones are LOW, MED ...
user avatar
2 votes
1 answer
507 views

Splitting string using ArcGIS Pro field calculator

Generating an error in what should be a basic field calculation. I have two text fields: MyAddress and AreaName. Both are text. I would like to use MyAddress to populate AreaName with everything ...
user avatar
  • 133
1 vote
0 answers
48 views

Determine field being updated using Field Calculator and Python parser

I have to updated some values in different fields and different feature classes. The calculation is always the same. For example if the field is called MyValue then the calculation would be ...
user avatar
  • 29.2k
-1 votes
2 answers
57 views

if/elif calculations with lists [closed]

I'm struggling to remember any Python code, I use it so infrequently. I want to write a simple if / elif statement but using any value from a list like a Boolean IN statement. So instead of: def Type(...
user avatar
  • 123
1 vote
1 answer
27 views

ArcMap Field Calculator - find and add last number

I'm trying to get a part of a string (numbers after letter) in a new table (field Description) using field calculator, but I need it only from a field next to it (field MUID) containing the first ...
user avatar
0 votes
0 answers
39 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.) ...
user avatar
1 vote
1 answer
28 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 ...
user avatar
  • 413
1 vote
2 answers
37 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 ...
user avatar

1
2 3 4 5
13