Questions tagged [python-parser]

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

Filter by
Sorted by
Tagged with
1
vote
2answers
11k views

Remove last 5 characters with Field Calculator in ArcGIS Desktop? [duplicate]

I wonder how to delete a word (or the last 5 characters) using the field calculator in ArcGIS 10.2. I have a column such as: Paris City; London City; Berlin City I need to remove "City", to be left ...
1
vote
4answers
1k views

Uisng Python Parser of Field Calculator with ArcPy?

I have a point shapefile with two columns i want to process. The first column is aspect and the second is aspect_m60, there is only one row with the aspect of my point. I have tried to write a script ...
1
vote
2answers
428 views

Using Field Calculator in ArcMap? [closed]

I am using Esri ArcMap 10.3: I have a very large table so I do no want to do this manually it will take me months (50k+ rows of data) My table looks something like below example. Purpose ...
1
vote
2answers
641 views

Python syntax error with If/elif statement in field calculator when using concatenation

I am unsure what syntax issue I am having with my If/Elif statement. I want to not use a column in my calculation if the value is blank. The end goal is to not have extra spaces before, after and ...
1
vote
2answers
409 views

Label specific lines in attribute table with syntax- ArcGIS?

I try to label a point layer for values in lines 1-11 only in this attribute table in field "OBJECTID" with this syntax (i saw this question also Labeling specific features in ArcGIS for Desktop?): ...
1
vote
3answers
425 views

Using if else syntax in field calculator with Python?

I want to calculate a field in the field calculator that are dependent on the values in 4 other columns. My columns are "A", "B", "C" and "D" Now I want to fill the column "X" with: if "A" and "B" ...
1
vote
2answers
179 views

Using Python Parser in ArcGIS Pro Field Calculator?

I am having a problem in migrating from Vbscript to Python for ArcGIS Pro. Building 5, Street 6 What is wrong in this expression? "{}:{}:{}:{}:{}:{}".format("Building ",!Building_Number!," , ",!...
1
vote
2answers
197 views

Using ArcGIS Field Calculator and Python Parser to add zeros and ones?

I have a lot of rows of data, and I want to use the field calculator to give a uniform assignment of 0 1 0 1 0 1 ... but I don't know how to implement it. Can someone help me?
1
vote
2answers
144 views

How to work around Field Calculator's character limit?

I'm trying to use the field calculator in ArcMap, however my code is way too long (1337 lines) and there seems to be a character limit: I'm only allowed to paste the first 103 lines. Is there an ...
1
vote
1answer
1k views

Calculating the log(10) of a field in ArcMap using the field calculator

I am trying to take the logarithmic function of a field in ArcMap 10.2 using the field calculator in my attribute table. I can't seem to find any equation that does this and the Help document did not ...
1
vote
1answer
813 views

Field Calculator: Round UP to the nearest thousand

I have a cost field in a table that I do field calculations on. The field contains values like: 1,000 2,100.00 3,500.99 4,900 I would like to use the field calculator to round the values up to the ...
1
vote
3answers
261 views

If/Then Field Calculator Return Calculations

After collecting GPS location for road culverts I would like to calculate the $ values for each culvert based on their diameter and length in ArcMap. Existing number fields in the attribute table are ...
1
vote
1answer
139 views

If/Then python script in Field Calculator not working

I'm working in Modelbuilder. I have a polygon in which I calculate the shape centroid in decimal coordinates (field called LONG_CENTR). Then I add a field (called FAJA) and I want to use a Field ...
1
vote
1answer
276 views

Editing Field using VBscript or Python in Attribute Table?

I add a field called Name in attribute table in arcgis 10.1 but I can't edit this field. From this site, I have learned that this can be done by field calculator using VBscript or Python. As I have ...
1
vote
3answers
914 views

Creating stacked Python label expression in ArcGIS Desktop?

I am using ArcGIS Desktop 10.3. I have a number of polygons representing exploration licences and a series of attributes including licence name, operator, partners and associated interests (%) ...
1
vote
2answers
2k views

If/else statement in arcgis

I try to fill the fields with the condition if / else but it does not work. I do not know where is my mistake in the code. def TextValue ( !Classe! ): if !Classe! == "Steppe arbustive" or !Classe! ...
1
vote
2answers
57 views

Filling attribute tables with values from the same attribute table

Just wondering if there's an easy way to fill null values in one column in an attribute table with values in another column of the same attribute table by just writing a query "just the "null values" ...
1
vote
1answer
58 views

Getting angle of point generated from DEM in Raster using Field Calculator in ArcGIS Desktop?

I am trying to calculate the angle of some specific points generated from flow direction in ArcMap 10.2. I converted the DEM to flow direction and then to points. I am trying to convert the grid_code ...
1
vote
4answers
134 views

Using ArcGIS field calculator with if else to populate field?

ArcMap 10.4.1 on Windows 7. I am trying to fill in some blank rows in a column using field calculator. The field I am trying to fill is: label. If it is empty I want it to be populated with a value ...
1
vote
2answers
53 views

Field Calculator Arc Map 10.2

I'm learning as I go , I can't figure out the correct script. I have data in a column named Full_Name which has 3 words ex: Arnault Branch Rd and I want to break it out to StreetName column to be ...
1
vote
1answer
188 views

Field calculator expression

I am trying to reclassify my vector layer but I seem to have a mistake in my Code Block. The following is an example of what i want; Old values: 10000 20000, 163000 230000 t/m 270000, 30000, ...
1
vote
2answers
89 views

Python parser in field calculator malfunctioning

Shouldn't this return everything but the last word in the street name? !Street_Name!.split(" ")[:-1] Python parser is checked. Receiving nulls after calculation. If I try to slice[0], I get the ...
1
vote
2answers
704 views

Avoiding error 000539 from code block in Calculate Value tool?

I do not have a very good understanding of python and have attempted to write a code block so that my model will skip rasters that do not contain any information and continue the process with rasters ...
1
vote
3answers
5k views

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

I am trying to calculate field test2 with only the numeric values from a string field test. The entire script is like: def makestr(test) list=[] for s in test: if s.isdigit(): ...
1
vote
2answers
196 views

If-Then-Else statement in ModelBuilder has improper syntax

I have a model that converts a road network into a different schema for a different program. In one step of the model I am converting values for a field "Class". I wrote an If-Then-Else statement in ...
1
vote
1answer
124 views

Changing all entries in field to be entirely lower case using ArcGIS Field Calculator?

I have a field with a bunch of species names, but for a single species there a bunch of case combinations (e.g. Cat, CAT,cat). I want to make a new field which has all the entries in all lower case. I ...
1
vote
3answers
103 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?
1
vote
3answers
167 views

“Length” field needs “ft” added to end of each number!

I have a field for "Length" regarding some data collected in the field. Unfortunately the "ft" after the number for the length had spaces or no spaces or a weird format, but basically I want Length to ...
1
vote
1answer
177 views

Field Calculator Expression Assistance - Return Value Based on a Text String in Another Field

I'm still in my infancy learning Python (also using arcpy), and I've got a field calculator expression that I am having trouble formatting. Hoping someone can help... I am using ArcMap 10.5. I am ...
1
vote
1answer
98 views

Python in field calculator parsing error

I'm trying to perform a selection in an attribute table based on two columns. The intital step I'm intending to perform is to select fields between values, e.g. (a > 0 and a < 10) and from this ...
1
vote
1answer
382 views

Remove first character from a string if it satisfies an if statement [closed]

I have a bunch of phone numbers and some contain a 1 in front of them e.g. "18885556607" and I would like to simply remove the 1. I can't just remove all first characters because there are numbers ...
1
vote
2answers
517 views

Using Python Function in Field Calculator to find numbers

Disclaimer, I am terrible at writing my own functions especially in the field calculator. I have an address field (Address) with records that are missing street numbers. I would like to find these ...
1
vote
2answers
273 views

Using ArcGIS Field Calculator to create classes in new field?

I first classified firstCol into groups and then I want to give the groups with different weighted values in another field, SecondCol. I will need to give different weighted values very often. I find ...
1
vote
1answer
158 views

How to work with accentuated strings in Python scripts in ArcGIS Desktop Field Calculator?

` pre-logic: def myCalc(name,nameVal): if (name == nameVal): return 1 else: return 0 var_name= myCalc(!Epulettipus!,"Lakóépület") ` This doesn't work with accentuated strings. (But ...
1
vote
1answer
39 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
2answers
378 views

Labeling using chemical formulas in subscripts that contain a mask in ArcMap 10.6

I would like to label points in ArcMap, and the labels contain chemical formulas. These chemical formulas have both subscripts and superscripts (see snip below) I am unable to use labels that both ...
1
vote
2answers
165 views

Labelling using Python Parser in ArcGIS Desktop?

I have limited expertise with Python. I need to create labels based on groups of attributes. I've figured out a clumsy way to accomplish this but it involves 20 different annotation classes / SQL ...
1
vote
1answer
708 views

Field calculator to calculate if field contains certain text

I have a field (WS_Type in the screenshot) that I want to use to calculate values based on the text within the field. The number of occurrences of each WS_Type in the field is not important, but the ...
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
91 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
675 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
197 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
1k 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
88 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
74 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
70 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
181 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
185 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
227 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 ...