Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [python-parser]

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

0
votes
0answers
11 views

Sum calculation in Field Calculator using Python script

I have a problem with Python script in Field Calculator. How to sum the values of one field ('AB') and paste the sum in another field ('RE') using Python in Field Calculator? I'm working in ArcMap 10....
1
vote
2answers
32 views

Use a python expression in Field Calculator to sum each row across several columns

this seems like it should be easy but I am new to python and am having trouble... I have four columns. I would like perform a field calculation that sums the values by row for three of the columns and ...
1
vote
1answer
19 views

Reclassifying field using Python wildcard string search?

I have a point layer with 900K Tree Point records. In that layer I have field (d_Species) that contains the tree species of each record. I've created a field (SpecieValu) to assign a value (0-3) for ...
0
votes
2answers
35 views

Splitting string ID code into various parts

I have a series of identification codes that I need to split out. The format of these codes is [region(letter)][district(number)] - [place(number)][subdistrict(letter)]. An example of some codes ...
0
votes
1answer
57 views

“No module named numpy” Python Error in ArcGIS Label Expression?

I have developed code to label points that pull formatting from a dictionary. I developed this code and it was working fine two weeks ago, today I try to open my map and I am now met with an error ...
1
vote
1answer
41 views

Autoincrementing one character in calculate field of ArcGIS Pro?

I am using ArcGIS Pro. I have this set of points where I like an unique id (uid). The only thing they need to be unique is a counter of some sort at the end. I have another field with some id that ...
2
votes
1answer
18 views

Modify script so only empty fields are changed in ArcGIS Pro?

I currently use a script that converts the integer in OBJECTID to a string and combines it with another string (in this case UAW,) to populate a field Field = str(!OBJECTID!) + "UAW" Now that I have ...
0
votes
0answers
18 views

Converting Text Field to Numeric in ArcGIS Pro?

I'm trying to convert text to numeric, but am unable to in ArcGIS Pro. Is there a Python function? I tried int(!FieldName!) but I think NULL values are messing it up?
1
vote
1answer
20 views

Using Python Lists in Calculate Field Code Block? [closed]

I'm looking for some help in explaining what exactly is occurring with the following code: MaterialLife = "LifeMaterial(!"+Material+"!)" codeblock2 = """def LifeMaterial(mat): material = {"ABS":...
0
votes
0answers
18 views

Calculating Raster Percentile Values in ModelBuilder

I want to calculate the 75th percentile value of a raster dataset (floating, 32Bit) and use this value as an input to a set null expression. I have multiple rasters to perform this on so I need to ...
2
votes
1answer
23 views

Splitting ID number along hyphens and creating new field with only parts of ID In Field Calculator?

I have a shapefile with polygons and each polygon has an ID number that follows a pattern like this: SMP_ID 1077-1-1 8-2-2 1281-1-3 304-2-1 In have created a new field and I need to populate it ...
3
votes
2answers
33 views

Python Expression for Labeling Addresses

I am trying to create a python label expression where only the first word of the address is labeled. Additionally I only want a label to appear if it is a number not a word. I have used this script ...
2
votes
2answers
141 views

Using Python in field calculator to extract highest value from 3 columns [closed]

I have three columns, one for percentage White, percentage Hispanic, and percentage African American per census tract. I'm trying to use Python to extract the population subtype with the highest ...
2
votes
2answers
31 views

Calculate field does not update using ArcPy

I want assign 33 if the field no_apt is zero and 34 if no_apt is any else value. The model run without any error, but no value are assigned the field GGV_kW. What is wrong with the code since it doesn'...
3
votes
2answers
111 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
0answers
39 views

Time series condition through field calculator [closed]

I am attempting to filter some time stamped data which I have enabled through the Convert Time Field tool, depending on a true/false condition. I am doing this through the field calculator within ...
0
votes
3answers
58 views

Converting VB codeblock to Python in ArcGIS Field Calculator?

I have created a tool in Model Builder to plot telecoms data - the user clicks a point on the map, enters a radius and enters an azimuth. The model then creates the buffer and cuts a segment out of ...
1
vote
0answers
40 views

Using IF-Statements in Calculate Field Code Block inside an Iteration

I have created a model in ArcGIS 10.2 that iterates through some feature classes in order to add a field 'Zmin10' (double) and calculate the field value based on a variable (called "Minimum") to which ...
0
votes
1answer
30 views

VBA/Python If/then statements in Field Calculator for one column based on another not working

I know this question has been asked a hundred times on here, for example: Basic If/Then in Python Parser of ArcGIS Field Calculator? Using if/elif/else statements in ArcGIS Field Calculator? Checking ...
0
votes
0answers
34 views

Calculating sequential numbers into sorted table not dependent on OBJECTID? [duplicate]

I am having a problem with adding sequential numbers to the new column based on other sorted value. I would like to use 'Sort by' column to be able to generate numbers in the 'Required number'column. ...
0
votes
1answer
58 views

Extracting numbers from string field but omit some unnecessary cells using Python Parser of ArcMap Field Calculator?

I refer to Extracting numbers from string field using Python Parser of ArcMap Field Calculator? The script above works fine for me, but I have to develop it a little. What I want is just to omit ...
0
votes
2answers
40 views

ArcGIS If/Else with calculation

I am seeking to calculate the variable MASSSTAB through rounding the variable LAENGE and doing some basic math. My codeblock currently looks like this: x = long(round(!LAENGE!, -1)) def ifBlock(m, ...
3
votes
2answers
126 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(!"+...
0
votes
1answer
41 views

Simple Field Calculation With No Results in ArcGIS Pro?

I have a grid in ArcGIS Pro that I've named the X and Y axis (in separate columns) and am now trying to do a field calculation on the total grid name (I've tried using both single and double quotes. I'...
1
vote
1answer
36 views

How to turn a string field with 2 numbers in two numerical fields in the atribute table?

I have a feature class with a big number of features. In the attribute table I have a string field made from two numbers separated by an underline (e.g.: 0_1, 98_237, 31_31...). I want to create two ...
2
votes
2answers
127 views

Converting none to zero (0) in geodatabase table using ArcPy?

I have an attribute table looks like this How do I convert Nulls into 0? I've tried to set this table non nullable type but got this: while the official doc says this: At least one of them is ...
0
votes
2answers
68 views

Concatenate fields (double and string) to create address using arcpy

fields: STNUM = double STRDIR = string STRNAME = string STRTYPE = string Tuple and s.format I have tried: arcpy.CalculateField_management (newparcelsUTM, "SiteAddress","{0} {1} {2} {3} ".format('!...
4
votes
3answers
211 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 ...
0
votes
1answer
38 views

Splitting second word of attribute using Python Parser of ArcMap Field Calculator?

This is Field Calculator in ArcMap. I am trying to split the word after the first space if the words starts with "San" like San Francsico, San Diego and etc. It return an error. Below is the script.
1
vote
0answers
39 views

Is there a way to use the project layout if using a plug in that creates batch maps through QGIS?

There is a plugin for biological records which creates batch maps for each taxon but it bypasses the premade project layout with a legend, picture of a logo and the copyright for each of them. Is ...
2
votes
1answer
51 views

ArcGIS Pro Field Calculator completing without error, but no change to Feature?

I'm attempting a research project in which I am seeking to categorize a municipality's Property Use Codes as Generalized Land Uses. For example, "AGRII - Developed Farmland" and "INDGR - Grain ...
0
votes
3answers
53 views

Making one field/values equal to another field/values

Lets say I have created a new field called "SFX" in a shapefile called "myshape.shp": input = r"C:\files\myshape.shp" arcpy.AddField_management(input, "SFX", "TEXT", field_length=100) There is now ...
0
votes
1answer
31 views

Add default month/day to known year in new date field?

I have a text field featuring a 4 digit year. How would I assign a default month and day to the year in a new date field? ex. 2010 needs to be converted to 1/1/2010 I attempted this in the field ...
3
votes
2answers
362 views

Using Python Dictionary to label subscript formatting ArcMap 10.6 [duplicate]

*Updated Question at bottom Update #3 I need to label chemical formulas out of the attribute table but the attribute table doesn't recognize anything but plain text. Therefore I have built a ...
2
votes
3answers
94 views

Using IF/ELSE Statement for field calculation in ArcPy?

I would like to calculate the slope value in %, but I don’t want to have any negative values. If there are negative values in the slope field, I would like to multiple them by -1 and if not, multiple ...
2
votes
0answers
46 views

Using Python nested if statement for labels in ArcMap?

I am trying to use python to write a label expression that will display a specific set of labels based on nested if statments. The expression should result in a 4 line label if the value is greater ...
0
votes
1answer
58 views

Creating label with number circle and field “1v” in ArcMap?

How to create a label which combines a circle number and field "1v" in ArcMap? For example: I need, a line the labels. My code label expression is: Function FindLabel ( [TOTAL_VIV] ) FindLabel = "&...
1
vote
1answer
36 views

Python Group by attribute range

I have about 6000 points that I need to run a computationally intensive analysis on. My thought process is to break this point layer up into six groups of 1000 points each. I'm trying to do this in ...
1
vote
2answers
79 views

Converting numbers 1,2,3,4 to 001,002,003,004 [duplicate]

How can i convert a field 1,2,3,4... to 001,002,003,004...010...? For example 1 change to 001 2 change to 002 3 change to 003 ... Is there any formula in field calculator?
2
votes
1answer
40 views

Calculating field on if-else-condition checking input parameters for <Null>?

I want to calculate a field depending on 3 input string parameters. Two of them can contain Null-values. My old VB expression was not able to work with Null-values, so the script stopped. Now I want ...
4
votes
1answer
101 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: ...
1
vote
1answer
36 views

Field Calculator Python Code for Between X-Y Calculation

I am trying to identify category based on two continuous variables and using IF ELSE logic for this. I intent to add elif statement, but even this code is throwing script error. Both attributes are ...
1
vote
3answers
93 views

Writing advanced label expression for ArcMap?

I have a label that I need to format using label expression. The label looks like this: EVA09C and I want the outcome to be this: EA09C Can I tell the label expression to skip the V in there?
0
votes
1answer
344 views

ArcMap field calculator error 000989 indention error?

I'm trying to make a four character output based on concatenating a single character field (in1) with either 1 or 2 zeros, depending on the length of in2, and then concatenating that . I'm getting an ...
3
votes
4answers
238 views

Concatenating address fields with possible blank or null values in fields using Python parser?

The following Python code is what I have already tried in field calculator of ArcMap 10.5.1: Pre-Logic Script Code: def ConcatAddr(!JOIN_KEY!) val = "" if !Address! <> val ...
0
votes
1answer
34 views

Combining string and returned value in label of ArcMap?

Using ArcMap 10, I am trying to label features with the first character in from the field "label." I can get it to return the first character, but I want the label to be Div L, Div X, etc.... Here is ...
0
votes
3answers
157 views

Advanced label expression in ArcMap to exclude part of a string

How do I write an advanced labeling expressions to only show a part of a string? I want my data that looks like this EVA007 only to show the 007 part.
0
votes
1answer
52 views

ArcMap label expression returning NoneType error

I'm trying to create street range labels rounded to the nearest 100 unless a street range is less than 100 I'm using "50". I have a field l_refaddr that is a string with number ranges for a street ...
1
vote
2answers
39 views

Merging duplicated fields within merged layer using ArcMap?

In ArcMap 10.6, I'm merging a series of layers with shared attribute fields. After I merge, every field is duplicated instead of combined, so it looks like this (real thing too wide for screenshot): ...
0
votes
3answers
48 views

Trying to clip many layers using Python in ArcMap, getting error that an output already exists

I have a nationwide shapefile I want clipped into regions. There's not so many regions that I need to script iterating through each region, but there are enough where I want to batch process this. I ...