Questions tagged [python-parser]

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

Filter by
Sorted by
Tagged with
2
votes
1answer
198 views

split attribute using ArcGIS Field Calculator

I have a long string in one attribute. I want to be able to extract a small portion of it into a new attribute. This is an example of the attribute: "< html xmlns:fo="http://www.w3.org/1999/XSL/...
1
vote
1answer
586 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
26 views

Classifying text field 'B' using integer in field 'A'?

I wrote an if elif statement that will loop through records (field A) and populate a new field (field B) based on A's contents. Field A name is 'CLASS'. Field B is 'class_desc'. reclass(!class_desc!...
0
votes
2answers
71 views

How do I .replace/remove within labelling [closed]

I would like to remove N_A and N123#N123 from my Labels. How do I do that? So far: str([RTN]).replace('N_A',' ') I still Need to remove the eg. N123#N123 as well from the Labels, but keeping the ...
1
vote
4answers
113 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
1answer
210 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 ...
0
votes
1answer
260 views

Calculate field : find the minimum value from other fields, but exclude the zero

Using solution from post : https://stackoverflow.com/questions/29284929/rejecting-zero-values-when-creating-a-list-of-minimum-values-python-field-calc My goal is to populate my "least" column with ...
-1
votes
1answer
44 views

Field Calc Python/VB script to populate field with one field, along with the last 6 digits of another [closed]

I'm trying to populate a field in a table using field calculator with the value of the field in another, concatenated with the last 6 digits of another field.Example below, I would like a field ...
0
votes
1answer
57 views

Converting Angles in a File Geodatabase Table - via Field Calculator's Python

In a file geodatabase table, I have an attribute called 'NEAR_ANGLE' created via the "Generate Near Table" tool that I'd like to convert to a 0-360 degrees format. I've created an attribute called '...
-1
votes
1answer
195 views

Convert VB CalculateField_management expression to Python in ArcPy

I am trying to change VB expression of CalculateField_management to Python expression. What I am trying to achieve is to adding suitability rank values to new fields for a dbf created out of raster ...
0
votes
1answer
1k views

Sorting strings separated by commas within field using Python Parser of ArcGIS Field Calculator?

In ArcGIS 10.4.1, I am using the Python Parser of the Field Calculator. My Python knowledge is limited. I would like to recalculate a field of strings that are separated by commas so that they are ...
4
votes
1answer
162 views

Reclassifying Vector Field using python parser in field calculator

I am attempting to reclassify a field in ArcMap using python within field calculator. Below is screenshot of how it is set up. when I run the reclassify I get an error, and my prepossessing results ...
2
votes
1answer
271 views

Calling %Variable% in Python Code Block in ModelBuilder?

I have a parameter in a ModelBuilder model I am running that defines the geodatabase that all of the temporary files will be written to. I need to be able to call that variable in a field calculator ...
0
votes
1answer
233 views

If-then-else Statements and string errors?

I'm defining a string field based on contents of another string field. Simply put, if the contents of field A contain this value, then fill field B with this text. It throws a string related error ...
1
vote
2answers
194 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?
3
votes
2answers
346 views

Automating Select By Attributes and Calculate Field?

I have zero experience with python and very little experience with ModelBuilder in ArcGIS. I have a shapefile with two fields, let's say their names are "Function" and "Regulation". What I need to do ...
1
vote
1answer
222 views

Using ArcGIS Field calculator with global variable?

I have an issue with creating a field calculator expression in python that utilizes global variable. How my table looks like: This is a fragment of road network shapefile. Each road has a code (...
1
vote
1answer
52 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 ...
0
votes
1answer
20 views

ArcGIS Field Calculator for changeable 3 fields add from table parameter at model builder and Python

I have an Excel sheet enter it to ModelBuilder as a parameter and at next steps i need to create an expression for the fields inside the table and add the results to another field. The problem is ...
1
vote
0answers
57 views

Using python parser of ArcGIS field calculator to calculate field using information from subsequent row?

When using the field calculator, how do I get data from the subsequent row in python? Let's say I want to add a new field called head_diff. I want to take the current row's value for head, minus ...
1
vote
1answer
59 views

Using ModelBuilder with Field Calculator gives SyntaxError?

I am brand new to coding, have no background at all. Basically I have about 200 tables with the same info listed under slightly different attribute table headings and I am trying to rename them to ...
2
votes
1answer
135 views

Using Field Calculator to split names but want to start count from right?

Just learning python on my own as I'm working. I have a column of street names where some are two words or three words, so counting spaces from the left to the right is outputting incorrectly for me. ...
1
vote
1answer
85 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 ...
2
votes
2answers
133 views

Make ArcMap label using the first letter from each word in an attribute [closed]

How do I create labels using the first letter of each word from a specific attribute, preferably using Python as the parser? For example, the attribute name is Common_Name and the values are eastern ...
5
votes
1answer
241 views

Calculating Polsby-Popper Score Using ArcGIS Pro Field Calculator gives ERROR 000539?

This operation is using the Field Calculator in ArcGIS Pro 2.1. I am trying to calculate the Polsby-Popper Score for Congressional Districts. I have calculated the Geodesic Area and Geodesic ...
0
votes
1answer
149 views

Getting ArcMap Python Parser to wrap text displayed in MapTips?

I have an attribute field [NOTE] that contains very long strings - often 255 characters - usually consisting of multiple sentences. I'd like to be able to use ArcMap's MapTips with some form of ...
2
votes
1answer
528 views

How to remove first two and last two characters from each label in ArcMap [closed]

My too long labels take up too much space in regard to the small counties polygons. I want to remove first two and the last two characters from each single label. Currently the labels on the map look ...
3
votes
1answer
56 views

Python code to count business days in ArcGIS field calculator gives ERROR 999999?

I'm trying to field calculate using a python script the number of business days between two given dates. Right now the dates are hard coded, but once I get the script working I will pass dates from ...
-1
votes
1answer
178 views

Python Script error in function ERROR 000539: SyntaxError

I am receiving the following error; is it a simple syntax issue with the Calculate field because I'm not seeing anything missing. ExecuteError: ERROR 000539: SyntaxError: unexpected EOF while parsing ...
1
vote
2answers
220 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 ...
2
votes
1answer
42 views

Conditionally omitting field values while calculating new field in ArcGIS Desktop?

I have six fields in a table and I want to calculate a new field based on a formula using these six fields. Suppose the formula is simply: newField = field1 + field2 + field3 + field4 + field5 + ...
2
votes
1answer
157 views

Replacing values with non-English characters 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 calculate and place the values in the other field. My ...
1
vote
2answers
136 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 ...
2
votes
1answer
38 views

Using Field Calculator to correct the nomenclature of APN values

I am currently working (in ArcMap 10.4) with two datasets that use different nomenclature for their assessor parcel numbers (APN) values. In one dataset the APN is a string dataset with the format "...
3
votes
1answer
599 views

Reclass Using Field Calculator in ArcMap

I'm trying to reclass 3000, 2000, 1000 and 0.5 into 1, 2, 3 and 4 respectively in a new field using field calculator. However it keeps returning an error message and I can't figure out why, any ideas? ...
3
votes
1answer
79 views

Adding unique indexes which start with “A” go up to 99 (A1-A99) and then start again “B1” and continue up to B99 and so on? [closed]

i want to add unique indexes which have to start with "A" go up to 99 (A1-A99) once the 99 rows of finished it has start again "B1" and to continue up to B99, so this index system has to continue ...
3
votes
1answer
184 views

Calculating sequential values in ArcGIS Desktop?

Previous posts (such as Adding automated values to attribute field?) answer how to calculate sequential values in an attribute table. The posts all seem to rely on the process described in this ESRI ...
0
votes
0answers
31 views

Field Calculate unique ID, based on another column, overriding FID / Object ID order [duplicate]

I have a couple thousand polygons across several hundred towns. I want the polygons within each town be labelled as such - first 3 letters of town name + _ + incrementing ID, so that they might look ...
4
votes
1answer
183 views

Field Calculator - use a string field to determine how a calculation is applied to a numeric field

I have a String field ('Prefix') and a Double field ('Result'). I am trying to group data by a specific range, <0.002, 0.002 to 0.07, >0.07, however some values have a '<' or '>' prefix ...
0
votes
1answer
60 views

Using Python to input datasource of layer into table field

I am using a bit of Python code to create an attribute table field and then I want to populate that field with the layer's datasource. I have been using addField management and then calculateField ...
6
votes
3answers
977 views

Using degree symbol in Label Expressions of ArcMap? [closed]

I am trying to use the labeling process to display latitude and longitudes for a set of data points. To make the labels appear formal, I wish to add the degree symbol (°) to the labels. My python ...
1
vote
1answer
54 views

Using Python codeblocks in ArcGIS to evaluate if all values in many columns is 0

I'm working on zoning data and I've been evaluating if the percentage for various zoning is more than 90% of the area, so I can define it as that zone in a new field, like so: def ifBlock(RS, RM): if ...
2
votes
2answers
111 views

Identify closed polylines in ArcGIS using Python

Running ArcGIS 10.2 here and a complete beginner with Python. I'm trying to figure out a workflow to test for closed polylines using the field calculator. Essentially what I'd like to do is to ...
1
vote
2answers
618 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 ...
3
votes
1answer
258 views

Complicated expression for Calculate Field for arcpy

I have a working formula that I can put in the Field Calculator which I'd like to use in my python code: .3-.001*Log ( [Field1]+1 )-.02*Log ( [Field2]+1 )-.04*Log ( [Field3]+1 ) My code: ...
4
votes
1answer
79 views

Recalculate a Field with data from another field, ignoring NULL values

I have a Feature Class in a Geodatabase with an field for pipe diameter. I also have a shapefile with a field for diameter. The shapefile is from field verification work that verified a variety of ...
1
vote
1answer
56 views

Replace attribute value with non NULL values from a joined attribute column [duplicate]

I have a Geodatabase with a column for pipe diameter. I have a secondary data set with field verified data and a column for pipe diameter. I would like to replace the pipe diameter in the Geodatabase ...
2
votes
1answer
66 views

Determining distance on line of point, given measure?

I need to determine into a standalone python script the distance of a point on a polyline with M-values and its' coordinates, at a specific measure. For example, I have to calculate the X,Y of a ...
6
votes
1answer
3k views

Writing Python code block in field calculator?

I am a novice in Python as well has having minimal experience with ArcMap. Currently I am using a U.S. Census TIGER file, mapping roads in Harris County, TX. I want to add a new field called SPEED, ...
1
vote
2answers
923 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 ...