Questions tagged [python-parser]

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

Filter by
Sorted by
Tagged with
1
vote
1answer
53 views

Changing Number order in the same column in the ArcGIS Shapefile

I have two types of number in my shapefile/database in the same column as follows. The first one does not have any alphabetic character but second one has alphabetic characters. (a) 26 25 21 0000 ...
1
vote
1answer
104 views

Using python to convert string values with Calculate Field in ModelBuilder?

In ArcGIS 10.5, I am building a model that should convert a field of coded values to another code. This seems like it should be a simple if/then statement but I am not getting it. To simplify the ...
1
vote
2answers
1k views

Replacing multiple values in attribute table field using ArcGIS field calculator and python parser?

I'm new to python and trying to write a python script using the field calculator in ArcMap for a specific field in an attribute table that will replace some of the values in the field but leave the ...
1
vote
4answers
841 views

Using Field Calculator with .replace?

I'm using the Field Calculator .replace function to replace WEST, EAST, NORTH, SOUTH to W, E, N and S and I'm using 4 scripts !PREDIR!.replace("WEST*","W") and so forth. I would like to use one ...
1
vote
1answer
225 views

Replacing last word in string using ArcGIS field calculator?

In this table I need to change the last word from field !name! using the text from field !abbreviation! I was trying to use Python parser to get the text from !name! field without last word and ...
1
vote
2answers
3k views

Create 'Season' column from 'Date'

I'm somewhat familiar with ArcGIS Desktop, but have no experience in Python. I have about 100 shapefiles which have an attribute table containing a date, but I need a column which contains a ...
1
vote
1answer
102 views

ArcGIS field calculator, shorten text

I am new on Python and using Python within ArcGIS and a bit stuck hoping someone could point me in the right direction. I want to remove the 6 last characters if the field is longer than 6 ...
1
vote
1answer
79 views

Label expression problem?

I am mapping the municipalities 911 numbers on our road network and built a simple python expression to find the lowest value between 2 fields. Then it shows that value on the line followed by an ...
1
vote
1answer
73 views

Understanding Label syntax in ArcGIS for Desktop?

In the context of this question Label specific lines in attribute table with syntax- ArcGIS? i build this python phrase in ArcGIS 10.3: def FindLabel ([OBJECTID]): if long([OBJECTID])==125 and ...
1
vote
1answer
200 views

Python code in ArcGIS field calculator error?

I've tried writing a code block using the Python Parser of the ArcGIS Field Calculator. Here's what I am trying to achieve: There's a field in my attribute table with values for some, but not all of ...
1
vote
1answer
208 views

Skipping when value is Null in ArcMap dynamic label expression?

I have a table of contents with multiple owner agencies that may or may not have an acreage value in the field and am trying to get a dynamic label expression to only write out the label for the ...
1
vote
1answer
254 views

Using elif statements in Python parser of ArcGIS Field Calculator?

Looking for some help. I have a continuous variable (PCT_B100P) of the percentage of folks in a census tract that are under the 100% federal poverty line. I'm trying to use this variable to assign a ...
1
vote
1answer
169 views

Calculate Field throws an error when parsing python with backslashes

I have an FTP I need to access through a python script. It works fine with forward slashes, but I don't need it to be read as an html. Below are both sets of code: Working: arcpy....
1
vote
2answers
2k views

“CountIf” or alternative function in ArcMap field calculator?

Within ArcMap 10.3 field calculator, I am looking to count the number of features in a column that match the current value, and output that count. Ideally, the output would look like this: Number &...
1
vote
1answer
414 views

Labeling Count values from Arcgis attribute field

Today at work I was facing some challenges to Label the count values from attribute tables of the feature class. We have all the data stored in geodatabase that is server based. I wrote python code in ...
1
vote
1answer
88 views

Using label properties/expression in ArcMap to label several ranges of numbers within feature class red?

I have about a thousand labels, some of which need to be labeled red. For example, 511-533 and 659-671 need to be labeled red, and the rest can be labeled in black. They are all part of the same field ...
1
vote
1answer
315 views

Performing If Statement in Python Parser of ArcGIS Field Calculator?

I've one field "MAXSPEED". I want a Field Calculation that will calculate an additional field ("noise"): If MAXSPEED > 40 then the term: (73.5 + Log ( 25 ) * ( [MAXSPEED] / 50)) should be used to ...
1
vote
3answers
497 views

Calculate Field with Python Parser an If statements?

I don't know a whole lot about python and scripting, so I was hoping somebody could give me a couple pointers on fixing some code. I am trying to calculate a "final results" attribute field. The ...
1
vote
1answer
1k views

trouble with code block execution in python script

I am trying to calculate values for a field in a python script, but keep getting an error that I don't understand: ExecuteError: ERROR 000539: Error running expression: Fron000000F1 Traceback (most ...
1
vote
1answer
245 views

Python codeblock not recognizing field?

I've been through multiple iterations / gyrations, and while there may be multiple problems here, the recurring issue is that the codeblock does not identify the existence of any syntax errors, but ...
1
vote
1answer
609 views

Returning end of string up to certain character using Python Parser of ArcGIS Field Calculator?

I am trying to accomplish this task: https://stackoverflow.com/questions/15851568/how-to-get-the-last-part-of-a-string-before-a-certain-character within the Field Calculator. I have the below but ...
1
vote
4answers
339 views

Calculations in if statement

I want to perform a simple calculation with the Field Calculator using this piece of script (note that all the elif statements are attempts for another syntax and non of the worked): def change(...
1
vote
1answer
107 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
1answer
34 views

Python code snippet to label years (e.g. 2015) and not label anything with a 0

I've been unable to solve this seemingly rudimentary issue of running a python snippet via the label expression option in ArcGIS. I've read this documentation Building label expressions, but wasn't ...
1
vote
1answer
369 views

ArcGIS Pro Field Calculator Python IF statement

I'm attempting to populate a newly created field with values dependent on an existing field. The new field has text data type. The existing field is double data type. This is the python code I've ...
1
vote
2answers
45 views

Adding time to variable using Python Parser of ArcGIS Calculate Value tool?

I am using Python 2.7 in calculate value in ModelBuilder. I want to query both 30 seconds before and after the variable. The original value keeps returning not the time change. What am I not defining? ...
1
vote
1answer
59 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 ...
1
vote
2answers
163 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?
1
vote
2answers
153 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): ...
1
vote
2answers
287 views

Removing part of string in ArcMap using Python? [closed]

I have a Field in this table which reads, and this is a sample because there are over 82,000 tracks in this county, "40 acres". I do have this Script which I know took the "Acres" portion out of the ...
1
vote
1answer
142 views

Use if statements in Calculate Field Code Block to give features in a field different values

I've been self learning Python. Now I want to play a little with the Python code block so I can be more comfortable building my own expressions later on. Right now I am just playing with this water ...
1
vote
1answer
91 views

Field Calculator runs without error, but does not populate desired fields

I have merged numerous datasets that have the same attributes in different fields. I have TotalAcres, Total_Acres_Burned, TTL_ACRS, etc... I am trying to use field calculator to populate one field (...
1
vote
1answer
344 views

ArcMap - Field Calculator / Calculate Value - extract month of median date between two dates

I have a String field 'INTERVAL' giving the two dates used for a difference image in the form "YYYYMMDD_YYYYMMDD". I would like to populate a second field 'MONTH' giving the month of the median date ...
1
vote
2answers
304 views

Conditional statement in field calculator using Python parser ArcGIS

I have looked at many threads on here asking about coding nested if-then or conditional statements in field calculator in ArcGIS. This seems to be a common problem for beginner programmers. I've ...
1
vote
3answers
176 views

Batching Python script in ArcGIS field calculator?

I know nothing on scripts- learning as I go, I have a point shp file that has a column named SUFFIX in the column the words are spelled out AVENUE, ROAD, STREET, SQUARE and so on. Therefore I'm using ...
1
vote
2answers
1k views

Changing Format of Date Field in ArcMap Field Calculator?

I am trying to change the format of date field using ArcMap field calculator. My data is currently in the format "%d/%m/%Y %h:%m:%s" (e.g. 5/05/2016 12:25:46 AM) I want to change this to "%d/%m/%Y" (...
1
vote
2answers
308 views

Field Calculator Parsing error SyntaxError: invalid syntax (line 2)

I'm writing a conditional in the Field Calculator and it's giving me an error of syntax in line 2. Can someone see it? The Code Block is this: def ZFactor(LAT_CENTR) : if (10.000 < math.fabs(...
1
vote
1answer
157 views

Parsing Address in Field Calculator

I'm trying to parse up the addresses in a table using the above code. It runs but only produces NULL. I have run out of ideas
1
vote
2answers
12k views

TypeError: coercing to Unicode: need string or buffer, NoneType found in ArcGIS labeling?

I have found out how to label using multiple attributes via an expression and python. What I have is as follows: [ID] + '\n' + [Notes] An ID example is "MH108" and a notes example is "buried, no ...
1
vote
1answer
355 views

Converting label expression from VBScript to Python in ArcGIS Desktop?

I have a feature class with label expression in VB script. I do not have the skill to convert a VB script to a python script. Here is the VBScript:- Function FindLabel ( [DESCRIPTION] ) if (left(...
1
vote
1answer
564 views

Deleting Blank Spaces in Excel sheet before Importing to Table?

I have developed a model that imports an excel sheet and converts it into a table. It then joins values within this table to a particular feature class. I then use the calculate field tool to copy ...
1
vote
1answer
521 views

Add classification value to attribute table?

I am trying to create a score for values in a table based off where the values fall within a classification range. Have: Attribute table with income, range= $29,725 - $76,996 Layer Properties ...
1
vote
2answers
1k views

Getting days of week from date field, with field calculator? [closed]

I'm using ArcGIS 10.3.3 and have a field containing a date as following format M/D/Y. I need to get the day of the week based on my date field. I need to do this from the field calculator. Example ...
1
vote
1answer
562 views

Avoiding multiple elif statements in Python parser for ArcGIS label expressions?

My code for labels look like this: def FindLabel ( [NAME_GEO] ): if [NAME_GEO]=="Tbilisi" : return "<BOL><FNT size ='14'>" + [NAME_GEO] + "</FNT></BOL>" elif [...
1
vote
1answer
70 views

ArcGIS - if clause in the field editor with python

I have 2 columns in my table. "dB1" and "dB2" Now I want to calculate a third columnn "dB3" depending of the entries in column "dB1" and "dB2" if "dB1" or "dB2" have an entry of "0" I want to ...
1
vote
1answer
128 views

ArcMap function in field calculator not working

Trying to return everything except the last element in a field after splitting it. Using ArcMap 10.2.2 in the field calculator. !ST_NAME!.split(" ")[:-1] This returns a null value in attribute ...
1
vote
3answers
1k views

Script for Sum of Rows in field calculator - VB or Python?

I wrote the TOTAL_FREQUENCY values manually. But I want to automatically write this values with a script. Namely, I want to write sum of column 3 to all of the the column 5 rows. How can I do it with ...
1
vote
1answer
59 views

Python not appearing as option for parser in label expression dialog of ArcGIS Desktop 10.0?

I have ArcMap 10.0 and python is not appearing as a parser option in the label expression dialog box, only VBScript and JScript. Python is installed and the python window works fine. Any idea how I ...
1
vote
1answer
274 views

Iterating through list of fields using field calculator?

import arcpy, sys, itertools arcpy.env.workspace = r'path to geodatabase' fields1 = ['gearqty', 'cnemarea', 'fzone', 'qdsq', 'tensmsq', 'crew', 'nanglers', 'port', 'totalquant', 'trip_days', '...
1
vote
1answer
155 views

Assigning values to field based on values in other field using Python Parser of ArcGIS Field Calculator? [duplicate]

I have a table with two fields A and B, and i want fill field B with "some values" from field A: FieldA: 123456_CC; 123_D; 1234567_AB; 123456768_F I just need the "text" that is associated with the ...

1
5 6
7
8 9
12