Questions tagged [python-parser]

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

Filter by
Sorted by
Tagged with
3
votes
2answers
248 views

Populating Attribute field using Python code without copying over null rows?

I am trying to copy the values from one column within my attribute table (!roomName!) over to another column (!spaceDiscriminator!). I understand how to do an easy field calc over for all the values ...
3
votes
2answers
4k views

Field calculator if and elseif statement with <Null> values in ArcGis 10.1

Trying to figure out how to get this "Headwater" column to indicate "Yes" (or 1) if the value of "NextDown_Copy" is "" and "No" (or 0) if it has any other value (eg. 7100381010). I attempted to try ...
3
votes
2answers
723 views

Python find string with two decimal characters in ArcGIS field calculator?

I have two columns in a personal geodatabase table that I'm trying to add up (to a third field) using a python function in field calculator, however some of the string values are not real numbers. e....
3
votes
2answers
474 views

Extracting data from HTML field in table using ArcGIS Desktop?

I'm operating ArcGIS. I need to make a calculated field. The value of the field is a sub-string of one of the other fields. My problem is that the other field (PopUpInfo) is an HTML string: An ...
3
votes
1answer
1k views

Using Python Parser in ArcGIS Field Calculator to compare two fields?

I'm trying to use field calculator to compare two fields in a table of tax parcel data, Land Value (LAND_VAL) and Improvement Value (IMPRVT_VAL). My goal is to determine (1) Parcels with land value ...
3
votes
1answer
191 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 ...
3
votes
1answer
294 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: ...
3
votes
1answer
753 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 ...
3
votes
1answer
784 views

How do you label only the odd or even integers of a field using python in the label expression in arcmap?

I'm new to python and would like to use the label expression box with python to display only the odd or even integers from the field, [Frame_Number]. I was thinking something like def FindLabel ( [...
3
votes
2answers
1k views

Calculate QUARTER from Date field using ArcGIS Field Calculator?

I currently have a Date field in the format of MM/DD/YYYY. My goal here is to convert the Dates into 1 of 4 quarters, along with the Year. The field to be created will be called QTR_YR. My first ...
3
votes
2answers
965 views

IF THEN statements in ArcGIS Field Calculator

I'm not sure if this would be best handled in vbscript or python, and unfortunately I'm less than novice at both so I'll take any help I can get from the exchange. I'm trying to take my streets layer ...
3
votes
3answers
3k views

Using Calculate Field tool to calculate on null fields?

I'm using ArcGIS 10.1. I want to use the calculate field tool in ModelBuilder on a table where if field1 is null, it should take the value of field2. If field1 has a value then it should stay as is.
3
votes
1answer
1k views

Field Calculate Degree Minute Second in Different Format?

I have a field that is in degree minutes seconds, populated from ET Geowizards COGO Inverse tool. It populates the values as 90-12-28.15 where 90 is the degree, 12 is the minutes and 28.15 is the ...
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 ...
3
votes
1answer
304 views

Trying to shorten length of a field using field calculator

I currently have a field that has text for a hyperlink to a photo that I am trying to shorten. I only need the name of the file at the end but the length of the name varies by a few characters. The ...
3
votes
1answer
466 views

Removing white space from field using field calculator

I am trying to remove extra spaces from values in a field programatically using a python script. This is the script I'm using: field1 = "FULLST_NAME" calc1 = "s.join(!" + field1 + "!.split())" s = "\'...
3
votes
1answer
383 views

Updating Field using Field Calculator Python

I am trying to update my Status field as seen below: I want to change the Null and Existing values to Permanently Removed using the Python Parser; however, I am receiving an error. Can someone ...
3
votes
1answer
2k views

Inserting substring in ArcGIS Field Calculator

I'm trying to use the split tool in ArcGIS to add an underscore. Trying to make "ABC11111" look like "ABC_11111". Don't have much experience using Python or VB Script but this is what I have created ...
3
votes
2answers
968 views

Adding both string and automated numbers in series to attribute table using ArcGIS field calculator?

I would like to fill a column in my attribute table with an string that ends in a numeric value. Example: Object001 Object002 Object003 I would like to automate the process of filling in the ...
3
votes
2answers
46 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 ...
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
1k views

ArcMap Field Calculator Remove Null values

I would like to remove the NULL/empty values from a table that is stored in a Geodatabase. Last time I tried doing so it worked fine, today I have some issues with the codes (Double Field). I have ...
3
votes
3answers
878 views

Replace occasional Space with Underscore using Python parser of ArcGIS Field Calculator?

I am creating a model which will give me two string values, one which reads exactly what is in a field and another which automatically replaces any Space with an "_". I have used Calculate Value tool, ...
3
votes
2answers
443 views

Using ArcGIS Desktop field calculator (python) to parse date

I'm trying to parse a datetime field using python (but have never used python for it before). I have a field that contains a valid date, but not a valid time... and other fields that have valid hour ...
3
votes
2answers
900 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 ...
3
votes
1answer
672 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
239 views

Python labeling code - remove empty values

I'm a GIS technician who is (slowly) learning python. I'm using it to generate custom labels in ArcGIS Desktop 10.4. I have a point layer with 10 fields but no point uses all 10. I'm trying to display ...
3
votes
2answers
202 views

Calculating a percent from attributes in label expression

I am trying to edit my existing python code in the label expression in order to add one more bit of information to the map. The purpose is to automate fire maps creation through data driven pages for ...
3
votes
1answer
490 views

Accumulating values of date field using Python parser of ArcGIS Field Calculator?

I would like to modify the following accumulative/sequential python code sample in field calculator in a Date Time field. I think this is the correct code to use but let me know if not. The Date Time ...
3
votes
2answers
3k views

Calling variables within ArcPy functions using Calculate Field tool?

I have a defined function (ex. def my_function(x,y)). def my_function(x,y): """algorithm""" my_variable = my_function(filex, filey) How can I call this variable within the code block section of ...
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 ...
3
votes
1answer
292 views

arcpy CalculateFieldManagement - single quotes in expression

I'm using the following to write a value to a field. arcpy.CalculateField_management (newPha, "PHACODE", """'{}'""".format(name), "PYTHON_9.3") The only problem is that the string I'm attempting to ...
3
votes
1answer
249 views

Concatenate fields value excluding empty values

I need to concatenate the value of two fields excluding empty values, using Field calculator. The fields are: AREA_HI and AREA_LO I have tried using a Python script but ArcGIS returns an error "...
3
votes
2answers
886 views

Calculating Z-scores using ModelBuilder in ArcGIS Desktop?

I am trying to take the natural log and then calculate z-scores on cell values in several composite band GRID rasters in ArcGIS Desktop. I am not fluent in Python and do not see a way to automate ...
3
votes
1answer
2k views

calculate value using maximum value from different feature class

I'm trying to get the maximum numeric value from one feature class and use that value in an expression to calculate values of a different feature class. fc2.bldg_id = max(fc1.bldg_id)+1 Can this ...
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 ...
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 ...
3
votes
1answer
1k views

Calculating field based on content from another table with no join in ModelBuilder?

I'm trying to work out how if (at all) it is possible to do a field calculation where there is no join or relationship between two attribute tables in ArcGIS 10.3.1. I've searched all over the place ...
3
votes
1answer
206 views

Maplex Label Expression in Python Parser of ArcGIS for Desktop?

I am using a python code in ArcGIS to define the size of the labels of a point feature class. Therefore I am using a label expression (Maplex). The label size of the TEXTSTRING (string) should be ...
3
votes
2answers
273 views

Field Calculator - conditional function and string variable?

I know this question has been asked before in different fashions, but I can't seem to get my python script to work despite looking at all the relevant questions I could find. I am simply trying to ...
3
votes
1answer
64 views

Using Arcmap to update a field based on data from another fields

I'm trying to update latitude and longitude data per individual station for a lab I'm working for. Here's some code I have that's supposed to assign any all bay stations of a certain name the ...
3
votes
0answers
42 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 ...
3
votes
1answer
695 views

Replacing multiple characters at once

I have a problem with replacing in field calculator. For some reason my Python parser is not working. So I'm going to use VB and having tonns of this Replace([field],"x","y") Replace([field],"z","a")...
3
votes
1answer
91 views

Python parser of ArcGIS Field calculator returns ERROR 000539: Error running expression?

I like field calculator and use it often, however found something very disturbing today when attempted to do this on a table of 3D feature class. def abc(shp,id): return shp.length -----------------...
2
votes
3answers
318 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
2answers
399 views

Fixing address errors using Python Parser of ArcGIS Field Calculator?

I am working on a task that will calculate a field to fix errors stemming from the Standardize Addresses tool and human error with the input data. The script is below. I'm getting Error 000989 "...
2
votes
2answers
217 views

Problem with direction calculation in ArcGIS

I want to calculate some values with field calculator using Python in ArcGIS table. I have used this link: http://support.esri.com/technical-article/000012478 but with different values of angles. I ...
2
votes
2answers
940 views

IF/ELIF statement returning NULL for values that are not calculated with field calculator in Python

I am using field calculator to change several values of field. I am receiving NULL values for those which are not in my function. What is the cause of this and a workaround? In the code below; I ...
2
votes
3answers
2k views

Using Python Parser of Label Expression to only show text after particular symbol?

I have a bunch of point data that needs labeling. However the attribute used for labeling is more complex than is needed in the map. Example of the attribute field for labeling: 15/8-9a, 001/15-2 8/...
2
votes
4answers
150 views

IF else statements arcmap, using python

I have a shapefile with a number of fields. I have one field (let's call it Field A) that I need to populate based on another field (let's call it Field B). If Field B is greater then 0 I need it ...