Questions tagged [python-parser]

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

Filter by
Sorted by
Tagged with
0 votes
0 answers
10 views

Using Parse path to remove extension in model builder. ERROR 000354: The name contains invalid characters

I am trying to iterate through a folder of rasters (approx 6,000) and calculate zonal statistics for roads/paths throughout GB that intersect with raster pixels. However, I am unable to generate an ...
  • 1
0 votes
1 answer
22 views

Giving unique attributes unique number using ArcGIS Pro [closed]

In a layer I am working with that has thousands of land owner boundaries and their names, I need to give all landowners a unique number (1, 2, 3,...). If a name appears multiple times (e.g. one person ...
-1 votes
1 answer
31 views

Getting failure in Calculate Field

After today's SW update I keep getting this failure, not sure why, but I am thinking it's the expression. I have no idea how to change the expression to something that makes sense if that's the issue. ...
2 votes
1 answer
107 views

Field Calculator for Multiple Fields

I am trying to get field calculator to work on 2 fields with multiple lines. Trying to have anything within RS10/R10 > 100,000 to return 1 if not then 0, also same results RS15/R15 > 150,000, ...
  • 23
0 votes
1 answer
64 views

Iterating through Calculate Field using ArcPy

I have three shapefiles as points that I am trying to create new fields for and fill in the fields with a string descriptor. I am then trying to merge all three point files deleting every field but ...
  • 51
1 vote
0 answers
46 views

Trying to calculate a field with code block but it is not filling the fields [closed]

I am using ArcGIS Pro calculate field. With this I want to fill the null values of a new field from another field using if and elif statements. The other field is "yearsINT" which is a short ...
0 votes
2 answers
84 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 ...
  • 721
0 votes
1 answer
95 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 ...
2 votes
1 answer
60 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 ...
1 vote
1 answer
44 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 ...
  • 43
2 votes
0 answers
66 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 ...
  • 21
0 votes
0 answers
39 views

ArcGIS Field Calculator: Sequential Numbers [duplicate]

I am attempting to populate a field with sequential numbers using Python but need to duplicate the sequential number created if values match in Field A. The below snippet obviously creates the ...
0 votes
0 answers
37 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 ...
1 vote
0 answers
41 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:...
  • 11
2 votes
1 answer
46 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 ...
1 vote
0 answers
109 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 ...
  • 918
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 ...
  • 11
2 votes
3 answers
114 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 ...
2 votes
1 answer
75 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 ...
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 ...
0 votes
1 answer
89 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( !...
-2 votes
1 answer
173 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 ...
3 votes
1 answer
133 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 ...
  • 61
-2 votes
1 answer
72 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
  • 1
2 votes
2 answers
169 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" ...
0 votes
0 answers
125 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,...
  • 107
1 vote
1 answer
146 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 ...
0 votes
0 answers
33 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(!...
  • 273
0 votes
0 answers
75 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 ...
  • 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 ...
0 votes
0 answers
40 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 ...
2 votes
1 answer
318 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 ...
  • 29
0 votes
1 answer
39 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 ...
0 votes
1 answer
48 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( ...
0 votes
1 answer
126 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, ...
  • 19
0 votes
0 answers
83 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 ...
  • 19
2 votes
1 answer
89 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 ...
0 votes
2 answers
61 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 ...
  • 15
-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 '...
2 votes
1 answer
44 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, ...
1 vote
1 answer
75 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 ...
  • 45
0 votes
1 answer
366 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 ...
2 votes
2 answers
102 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 ...
0 votes
0 answers
27 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 ...
4 votes
2 answers
88 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 ...
1 vote
0 answers
105 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 ...
  • 323
0 votes
0 answers
63 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","...
1 vote
1 answer
45 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 ...
  • 21
3 votes
1 answer
43 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 ...
2 votes
1 answer
1k 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 ...
  • 153

1
2 3 4 5
14