Questions tagged [python-parser]

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

Filter by
Sorted by
Tagged with
0
votes
3answers
555 views

Advanced label expression in ArcMap to exclude part of a string

How do I write an advanced labeling expressions to only show a part of a string? I want my data that looks like this EVA007 only to show the 007 part.
0
votes
3answers
67 views

Trying to clip many layers using Python in ArcMap, getting error that an output already exists

I have a nationwide shapefile I want clipped into regions. There's not so many regions that I need to script iterating through each region, but there are enough where I want to batch process this. I ...
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 ...
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 ...
0
votes
1answer
39 views

Calculating Time of Day

I want to calculate a text field call "TIME_DAY," depending of whether or not the time falls within of four time periods it should return one of four values. My script should work, but it doesn't. ...
0
votes
1answer
56 views

calculate field (prefer Python) [closed]

I have an attribute field with string data values (e.g. "P0001","C3492","00123"). I need to replace them so that they're all unique and begin with "W" followed by digits totaling 5 characters. I ...
0
votes
1answer
48 views

ArcGIS 10.2: VB to Python

I have the following VB code to produce a percentage in a field calculator. " [FIELD_1] / [Total]*100 " It works in VB. I've tried the following without luck. !FIELD_1! / !Total! * 100 Can anyone ...
0
votes
1answer
473 views

Error 999999 when using .isalnum in ArcGIS field calculator?

ArcGIS keeps throwing an error when I use the following script in the field calculator, using Python: pre-logic script code: y= () if !fieldx!.isalnum(): y= 1 else: y= 0 Fieldy= y The ...
0
votes
2answers
42 views

Reclassifying vector polygons based on text string to integer using Python Parser of ArcGIS Field Calculator?

So I am trying to reclassify a text string by searching for bits of strings and converting those strings to an integer value in a new field within the field calculator. e.g. I want to find all values ...
0
votes
3answers
77 views

Converting VB codeblock to Python in ArcGIS Field Calculator?

I have created a tool in Model Builder to plot telecoms data - the user clicks a point on the map, enters a radius and enters an azimuth. The model then creates the buffer and cuts a segment out of ...
0
votes
1answer
61 views

VBA/Python If/then statements in Field Calculator for one column based on another not working

I know this question has been asked a hundred times on here, for example: Basic If/Then in Python Parser of ArcGIS Field Calculator? Using if/elif/else statements in ArcGIS Field Calculator? Checking ...
0
votes
2answers
44 views

ArcGIS If/Else with calculation

I am seeking to calculate the variable MASSSTAB through rounding the variable LAENGE and doing some basic math. My codeblock currently looks like this: x = long(round(!LAENGE!, -1)) def ifBlock(m, ...
0
votes
1answer
80 views

Splitting second word of attribute using Python Parser of ArcMap Field Calculator?

This is Field Calculator in ArcMap. I am trying to split the word after the first space if the words starts with "San" like San Francsico, San Diego and etc. It return an error. Below is the script.
0
votes
1answer
749 views

ArcMap field calculator error 000989 indention error?

I'm trying to make a four character output based on concatenating a single character field (in1) with either 1 or 2 zeros, depending on the length of in2, and then concatenating that . I'm getting an ...
0
votes
1answer
37 views

Combining string and returned value in label of ArcMap?

Using ArcMap 10, I am trying to label features with the first character in from the field "label." I can get it to return the first character, but I want the label to be Div L, Div X, etc.... Here is ...
0
votes
1answer
207 views

Using Field Calculator to auto-increment in ArcMap? [duplicate]

I am trying to edit the basic sequential numbers in a field script using Python in the Field Calculator. I set the Parser to Python, and for my Pre-logic Script: rec=0 name="manhole" def ...
0
votes
2answers
76 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 ...
0
votes
1answer
153 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 ...
0
votes
1answer
342 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
551 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 ...
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: ...
0
votes
1answer
100 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 ...
0
votes
1answer
472 views

Editing buffers in Arcmap 10.3

Working for an environmental agency, they ask me to edit in ArcGIS the sizes of the buffers for the same layer. Is that possible to change it using python in the field calculator? If yes, I seek ...
0
votes
2answers
319 views

Error 000989 Python Syntax error in Field Caclulator

Using ArcMap 10.4 here and having some trouble running some python code in the field calculator. I am trying to populate one text field based on the value of another text field. Here is what I am ...
0
votes
1answer
179 views

Calculating a field error

I have this table: And I want to create a field called "COSN2" which after the creation I want to fill it with three characters from the field "COS207". Than I wrote the following script: import ...
0
votes
1answer
215 views

Calculate field python script returning NULL values

I have a script that I am using to create and calculate a new field based on the features spatial location. Basically, I have a geodatabase that contains parcels by county in florida, and I am trying ...
0
votes
1answer
524 views

Parameter variable in expression for Calculate Field Python Script?

Here is what I have import arcpy inputFC = arcpy.GetParameterAsText (0) #Feature Class inputField = arcpy.GetParameterAsText (1) #Field to manipulate inputChar = arcpy....
0
votes
2answers
48 views

Showing lowest value first after one-to-one spatial join with delimiter?

After a spatial join (one-to-one) in ArcGIS my result looks like this: (I use a / as delimiter) 2015/2015/2014/2014/2013 After that i use python in calculate field to filter out duplicate values ...
0
votes
1answer
526 views

Auto Generate Sequential Asset IDs

I am Looking for a python script that will automatically assign a unique sequential value to a field every time a new feature (asset) is created. This ID will also need the abbreviated name prepended ...
0
votes
2answers
1k views

Removing null value in labels of ArcMap?

Following this question: Label expression in ArcGIS gives TypeError coercing to Unicode need string or buffer NoneType found? I used this python expression in order to create a stacked label from ...
0
votes
2answers
121 views

Trying to use Python to clean up null/bad data in Lat/Lon Load

I'm using ArcMap 10.4. Trying to load a list of Lat/Lons and connect the surface hole and bottom holes with a line connector (Toolbox XY to Line). I have two issues: 1) Values which have BHL and no ...
0
votes
1answer
102 views

Copying point features along line features by predetermined distance

I have points in a feature class. Each point has its centroid on a unique line feature in a polyline feature class ( 62 points / 62 lines). Furthermore, points and their corresponding lines share ...
0
votes
1answer
1k views

Check that a Variable is NOT Equal to Multiple Values

I am trying to use a check a field against several values (eg: [Name] != 'NONE', and [Name] != 'N/A'). This is for the label expression builder within ArcGIS and I am using it eliminate label for ...
0
votes
1answer
45 views

Filling Field2 to icorresponding values in Field1 of shapefile using Field Calculator of ArcGIS for Desktop?

I have to give explanation in a new field of the existing field which contains abbreviation. Example: Field "Geology" has values Q, Qs,N....(abbreviation), I have to give explanation of those in a ...
0
votes
1answer
60 views

Adding spaces in string using Python parser of ArcMap field calculator

I am using ArcGIS Desktop 10.6. I have a integer field [no_lot] which contains values in the following format: '3 546 777' I need to transfer the data into a text field for joining purposes. I ...
0
votes
1answer
32 views

Calculating New Field using Python Field Calculator From Two Fields Returning Specific Numbers

I have never used the SQL function in the field calculator and need some guidance. I am attempting to calculate new field data (date update) using python for a client that will look at first at one ...
0
votes
2answers
35 views

Creating conditional stacked labeling in ArcGIS Pro?

I found a code example for what I'm looking to accomplish at Creating conditional stacked labeling in ArcGIS Pro? I want to display filter quantity and sizes for a school district per building in a ...
0
votes
1answer
29 views

Pulling date from filename and in proper format for time enabled use?

My feature attribute table has a folderpath that indludes a date time. Example:/documents/foldername/xyz2015OCT15063333.shp It seems very simple, but I am not a programmer and have done my best to ...
0
votes
2answers
48 views

Calculate time duration from military time with ArcMap Field Calculator [closed]

I have two text fields (STRTTIME, ENDTIME) which are are formatted as military time with leading zeros. For example, 0540, 1655. I want to calculate a new field with the time duration as integers (...
0
votes
1answer
77 views

Capitalizing and changing font/color in Label Expression using Python Parser of ArcGIS Pro?

Currently Using ArcGIS Pro 2.3.2 and Python. I am currently trying to label Road names, which are all uppercase in the database. I'm unable to edit the database but would like to Capitalize the road ...
0
votes
1answer
43 views

Auto Incrementing Field based on Selection of Records in Feature Class?

I'm attempting to write a script that will add an incremented value to a field based on a selection of records. For example, the script will select the first 300 records in a feature class and then ...
0
votes
1answer
52 views

Python Script is repeating results

I have developed a python script to copy and paste in the field calculator. Having an input of three values, it compares all of them and returns a list of unique values. The problem is that when I use ...
0
votes
1answer
181 views

Extracting numbers from string field but omit some unnecessary cells using Python Parser of ArcMap Field Calculator?

I refer to Extracting numbers from string field using Python Parser of ArcMap Field Calculator? The script above works fine for me, but I have to develop it a little. What I want is just to omit ...
0
votes
1answer
38 views

Add default month/day to known year in new date field?

I have a text field featuring a 4 digit year. How would I assign a default month and day to the year in a new date field? ex. 2010 needs to be converted to 1/1/2010 I attempted this in the field ...
0
votes
1answer
78 views

ArcMap label expression returning NoneType error

I'm trying to create street range labels rounded to the nearest 100 unless a street range is less than 100 I'm using "50". I have a field l_refaddr that is a string with number ranges for a street ...
0
votes
1answer
160 views

Calculate sequential ID field using ArcGIS Field Calculator? [closed]

In this example, previously posted as Calculating sequential numbers into sorted table using ArcGIS Desktop? : How do you construct a Python code that would give the Seq field sequencing such as: ...
0
votes
1answer
279 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 ...
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 ...
0
votes
1answer
328 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
405 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 ...