|
POST
|
I tried your suggestion to put it into a script but i still just get "No" for all the features. Would it have to do with the fact that the taxparcels address filed are all upper case letters and the points address field are all lower case?
... View more
10-04-2017
01:56 PM
|
0
|
4
|
2881
|
|
POST
|
Hi Mitch. thank you for the reply and help. I tried the code but i am getting the same results as before. I select the points in Arcmap and run the code in ArcMap python window. All of the point features have 'No' in the Verifi2 filed. on line 12 of your code should it be if row[1] != addDict[row[1]] since your comparing the SiteAddress and SiteAddres fields? Here is the code i am working with. import arcpy
from datetime import datetime as d
startTime = d.now()
fc1 = "AddresPointsTest"
fc2 = "TaxParcels1"
#set up cursors
cursor1 = arcpy.da.SearchCursor(fc1, ["SiteAddres", "Verifi2"])
cursor2 = arcpy.da.SearchCursor(fc2, ["SiteAddress"])
#build a dictionary of OBJECTID : Address pairs, change OID@ to your uniqueID
#addDict is for the taxparcels
addDict = {row[0]:row[1] for row in arcpy.da.SearchCursor(fc2, ['OID@','SiteAddress'])}
#search through fc2 to see if addresses match based on OBJECTID value
#again, change OID@ to your uniqueID
#UpdateCursor is for the address points
with arcpy.da.UpdateCursor(fc1, ['OID@','SiteAddres','Verifi2']) as cursor:
for row in cursor:
if row[0] in addDict:
if row[1] != addDict[row[0]]: #if the value associated with those ids do not match
row[2] = 'No'
else:
row[2] = 'Match'
cursor.updateRow(row)
del cursor
try:
print '(Elapsed time: ' + str(d.now() - startTime)[:-3] + ')'
except Exception, e:
# If an error occurred, print line number and error message
import traceback, sys
tb = sys.exc_info()[2]
print "Line %i" % tb.tb_lineno
print e.message
... View more
10-04-2017
08:15 AM
|
0
|
6
|
2881
|
|
POST
|
Yes they do have a unique ID that links them together. I guess i didn't think this through all the way...hummm So some parcels have an address point (separate layer) but some address points don't match the parcels(separate layer) site addresses i need to find the ones that match and don't match, but only of the selected features in ArcMap.
... View more
10-03-2017
01:49 PM
|
0
|
11
|
2881
|
|
POST
|
I am trying to update the points selected features field "Verifi2" with "Match" or "No" based on if the 'SiteAddres' field of the selected feature matches the parcels layer 'SiteAddress' field. I currently have the following code but all of the selected features have "No" in the Verifi2 field. Which is not the case because some of the selected point features SiteAddres does match parcels SiteAddress. I would appreciate some help please. import arcpy
from datetime import datetime as d
startTime = d.now()
fc1 = "AddresPointsTest"
fc2 = "TaxParcels1"
#set up cursors
cursor1 = arcpy.da.SearchCursor(fc1, ["SiteAddres", "Verifi2"])
cursor2 = arcpy.da.SearchCursor(fc2, ["SiteAddress"])
with arcpy.da.UpdateCursor(fc1, ["SiteAddres", "Verifi2"]) as cursor1:
for row1 in cursor1:
with arcpy.da.SearchCursor(fc2, ["SiteAddress"]) as cursor2:
row2 = cursor2.next()
#print row2
row1[1] = "Match" if row1[0].lower() == row2[0].lower() else "No"
#print row1[2]
cursor1.updateRow(row1)
try:
print '(Elapsed time: ' + str(d.now() - startTime)[:-3] + ')'
except Exception, e:
# If an error occurred, print line number and error message
import traceback, sys
tb = sys.exc_info()[2]
print "Line %i" % tb.tb_lineno
print e.message
... View more
10-03-2017
08:18 AM
|
0
|
14
|
4209
|
|
POST
|
It was my pc, i restarted my pc and recreated the file geodatabase and ran the script and it did what it was suppose to do. Sorry about that and thanks for the help!
... View more
10-18-2016
02:39 PM
|
0
|
0
|
1907
|
|
POST
|
What bug are you referring to, is there a patch for this bug? any other way around this?
... View more
10-18-2016
10:36 AM
|
0
|
2
|
5626
|
|
POST
|
I am on ArcGIS 10.3.1, i am runign the script on python 2.7.8 IDLE, the table is in a file geodatabase. I have attached a portion of table i am working with. Thanks.
... View more
10-18-2016
07:03 AM
|
0
|
4
|
5626
|
|
POST
|
Joshua thanks for the replay and updated code, but when i run the code it runs fun i don't get any error's but nothing happens to the table, no records are delete.
... View more
10-17-2016
09:38 AM
|
0
|
6
|
5626
|
|
POST
|
Thanks to both of you Joshua and Mitch for sharing some code it does delete the duplicates but i need it to only keep one of the Acct with 01 in the group_code field and the highest value in the value filed. unless i am not seeing something in your code...?
... View more
10-13-2016
02:22 PM
|
0
|
2
|
1907
|
|
POST
|
Darn i just realized that that i need it to keep just one of the Acct with 01 in the group_code but the one with the highest value in the "value" field. As you can see on the attached table there might be duplicate values.
... View more
10-13-2016
10:44 AM
|
0
|
8
|
5626
|
|
POST
|
I need to be able to delete duplicate records but keep one only if it has a certain attribute in a certain field in a table. so i need to keep one of each "Acct" row but only if it has "01" in the Group _code. I need to be able to do this in arcpy python because i get this table weekly so i would like to schedule this task. Attached is a pic of the table i am working with. I think i can iterate the "group_code" field and append the value and "Acct" to a dictionary. I have the following but i am not sure how to select and remove duplicates. I would appreciate some help with some code. import arcpy
from arcpy import env
env.overwriteOutput = 1
env.workspace = r"C:\GIS\LandValue.gdb"
fc = "LandValue3"
dict = {}
with arcpy.da.SearchCursor(fc, ["Acct", "group_code"]) as cursor:
for row in cursor:
dict[row[0]] = row[1]
del cursor
... View more
10-13-2016
08:28 AM
|
0
|
15
|
10448
|
|
POST
|
what i am working with . #Removes alpha at the end import string, arcpy table = r"C:\Temp\Default.gdb\LV" for field in arcpy.ListFields(table, "group_code", "String"): c = "group_code" exp = ''.join([i for i in c if i.isdigit()]) #''.join([i for i in c if i.isdigit()]) arcpy.CalculateField_management(table, "group_code", exp.format(field), "PYTHON_9.3") I am getting error . ExecuteError: Failed to execute. Parameters are not valid. ERROR 000735: Expression: Value is required
... View more
08-31-2016
02:46 PM
|
0
|
1
|
2838
|
|
POST
|
Maybe i didn't explain what i am needing correctly. working table looks like the following. OID group_code 1 35$# 2 12 3 26P 4 10 5 2 From what i understand is that c = "35$#' is the character to be checked. i don't just need it to check 35$# i need it to check the whole group_code field and remove the the Alph & Special Characters from all of the attributes in the "group_code" field. Like the following.. OID group_code 1 35 2 12 3 26 4 10 5 2 Or maybe i am not understand how to incorporate what you two suggested in to my current script.
... View more
08-31-2016
02:03 PM
|
0
|
3
|
2838
|
|
POST
|
I have a table with a field called group_code and in this field there strings like the following. 2,10,12,15H, 26P, 35$#. As you can see some have a alph and special characters and some don't. So i don't think i can use the cursor.updateRow([row[0][1:-1]]). I need to remove all the Alph and special characters at the end of each column for the group_code field. I have tried the following but no luck. I need this to be outside the field calculator. table = r"C:\Temp\Default.gdb\LandVal"fieldValue = "group_code"
#Removes alpha at the end for field in arcpy.ListFields(table, "group_code", "String"):
exp = ''.join([i for i in fieldValue if i.isdigit()])
arcpy.management.CalculateField(table, field, exp.format(field), "PYTHON")
arcpy.conversion.TableToTable(table, r"C:\Temp", "LandVal_Test.dbf")
... View more
08-31-2016
11:51 AM
|
0
|
10
|
5015
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 08-01-2024 07:19 AM | |
| 1 | 07-26-2024 09:38 AM | |
| 1 | 01-08-2024 09:44 AM | |
| 1 | 03-07-2023 11:46 AM | |
| 1 | 11-02-2020 08:24 AM |
| Online Status |
Offline
|
| Date Last Visited |
02-12-2026
12:36 PM
|