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
149 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
45 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
790 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
80 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
199 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
32 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
187 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
61 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
1k 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
133 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
654 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
314 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
83 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
60 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
69 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
4k 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
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 ...
0
votes
1answer
380 views

How to concatenate time and date field into one field using ArcGIS for Desktop Field Calculator or Python?

I have two fields, one is ISSUEDDATE and the other is ISSUEDTIME. I would like to concatenate fields so that the ISSUEDDATE is in m/dd/yyyy hh:mm:ss format. My ISSUEDTIME field is a string and ...
0
votes
1answer
618 views

Replacing values in one field with values from another using ArcGIS Pro Calculate Field tool?

I am in the infancy stage with python and have no idea where to start. I simply want to replace values in a field from a feature layer with the values in a field from a table I joined (to the feature ...
1
vote
1answer
342 views

ArcGIS Field Calculator Not Working With Date Field

I am trying to calculate a field based on the date values in another field. Here is my code from the pre-logic script code box: def getHalf(dfield): if dfield >= date '2017-08-27 00:00:00' AND ...
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
185 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 ...
0
votes
1answer
350 views

ArcMap Python script for attribute split, replace and concatenate [closed]

I have a problem with attribute table which I'd like to learn to solve without MS Excel. The Shapefile I have, has an attribute field, which consists of 3 parts, separated by ";" -sign. Here is an ...
0
votes
1answer
425 views

ArcGIS field calculator Python generate random point names from attribute table

I am new to arcpy and am looking to generate 15 random point values, which are names from an existing attribute column into a new column. I must use Python in the field calculator. My existing column ...
0
votes
0answers
60 views

python syntax error in field calculator [duplicate]

I'm trying to strip the last character in a string if when the string is split by spaces the last element has a length of 1. I then want to put that letter in front of the rest of the other elements. ...
0
votes
1answer
355 views

model builder expressions code block and definitions

I am having difficulty wrapping my brain around the point of the expression vs the code block. What am I suppose to be defining? I copied the example from calculate value in the ArcGIS help website ...
1
vote
1answer
839 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 ...
2
votes
2answers
199 views

Getting only time from Python parser of ArcGIS Field Calculator?

Using ArcGIS 10.4, how I can modify the Date() functions on VB or Python scripts of field Calculator Now ( ) datetime.datetime.now( ) to get only time like 12:32
0
votes
0answers
18 views

ArcGIS Field Calculator reformat Lat Long values [duplicate]

I have a table which is filled with point values that have been exported from an external source. Unfortunately the Lat Long values are formatted strangely and this is preventing me from simply ...
2
votes
1answer
550 views

Use Python in ArcGIS Field Calculator to return value based on numeric value in any of three other fields

I am trying to calculate a new field in ArcGIS 10.5 Desktop using the field calculator, based on the value in any or all of three other fields in the same table. I have not used Python for a while, ...
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 ...
0
votes
1answer
71 views

Field Calculator: Simple Python If-then and maths

I want to take all positive values in a field and multiply them by -1000. To do this, I put together the following code block: def myCalc(x): if (x > 0): x*(-1000) return x else: ...
2
votes
2answers
54 views

Trouble with if loop in Field Calculator

I'm trying to calculate a field using Python with field calculator but am running into a syntax error. I'm hoping someone can point out what the error is, and I can't seem to figure it out. Below is ...
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 ...
0
votes
1answer
64 views

Field Calculator: Prefixed, padded IDs from a number field

Using the Field Calculator, I want to create prefixed, padded IDs from an existing number field. By "padded", I mean I want the IDs to have a specific number of characters, regardless of how many ...
3
votes
1answer
873 views

Field Calculator: Split address into house number, street name

I have an ADDRESS field in a table with values like: 1 MAIN ST 20 SIDE AVE W 300 JOHN DOE JR RD S I want to use the field calculator to split the addresses and insert the parts into HOUSE_NUMBER and ...
2
votes
1answer
56 views

How to Modify and Combine rows in an attribute table?

I would like to modify this attribute table. This is an example First arrange column “ORG_FID” in ascending order If the number of rows corresponding to the column “block Number” is same as well as “...
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
1answer
133 views

Creating If Then statement in Field Calculator between 2 values? [closed]

I have a FC with a column for NEAR_ANGLE from the output of the NEAR tool. The angle is displayed in degrees (i.e. -154.67687) which is fine. I am trying to create a column, HEADING, that reads this ...
3
votes
3answers
2k views

Concatenating strings from two fields using Python in ArcMap Field Calculator?

I'm new to Python scripting and I don't understand what is wrong with this code. I want to concatenate the string values from GRID1MIL and GRID100K. I've created a text column MGRS to begin with. I ...
0
votes
3answers
421 views

Sequential IDs with field calculator: Pad a prefixed field to specific length

I have an ID field that is a text datatype. The IDs in the field have a prefix, and are padded with zeros to always be a specific length. Examples: INSP000098 INSP000099 INSP000100 INSP000101 I ...
0
votes
1answer
104 views

ArcMap Python Maplex labeling

I'm doing Maplex-Python labels for municipality polys with yields positive, zeroes and null values. I want to label all municipality polys by their municipality name, however I don't want to display ...
3
votes
1answer
74 views

Understanding ArcGIS field calculator behaviour with geometries?

In Getting Properties of Next Record Using Calculate Field Tool in ModelBuilder? the OP asks for suggestion on calculation of distances between pairs of points in a feature class. I thought of ...
0
votes
1answer
180 views

Parsing Data for Label using Python

I have field called PIN in my parcels shapefile. Formatting looks like this: xx-yy-zzzzz, just much longer. I want to split the first two sections on one line and the third (the z's) on the next. I ...
2
votes
1answer
308 views

Python in ModelBuilder calculate field tool

Code works on ArcMap "Field Calculator..." when I click on attribute and calculate. But if does not work in ModelBuilder calculate field tool. Any ideas? Pre-Logic Script Code: def ifBlock(...
2
votes
2answers
54 views

Using field calculator to find the next nearest (next minimum value)

I'm new to Python, but I'm attempting to find the next smallest value in a field, using another field as a case field (within field calculator in ModelBuilder). I've drafted the following, but it does ...
3
votes
1answer
53 views

Getting Properties of Next Record Using Calculate Field Tool in ModelBuilder?

I'm trying to calculate the distance between the centroids of adjacent records (adjacent in the attribute table, not necessarily in space) into an attribute field. I'm planning on using the ...
1
vote
3answers
164 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
4answers
698 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 2 3 4 5 12