I have a indoor positioning shp file. I need to do the data cleaning for the further analysis. and here is the attribute table:
Field(Sheet1_minor) is the name of beacon, and Fields(Beacon_41_B1,B2,B3,B4) which are near the beacon(Sheet_minor). I am trying to clean the noise data by filtering the same record or adjacent record. For example, i start to work from ObjectID 28, I want to testify if ID 29 value of field(Sheet_minor) is equal to ID 28 adjacent record(Beacon47_B1,B2,B3,B4).
- Yes->
testify ID 28 value of field(Sheet_minor) == ID 30 value of field(Sheet_minor), if this equation is true,delete ID29 and ID30. if this equation is false, skip it.
- No->
skip this record. Here is my code, but it doesn't seem to work.
# Licence: <ArcGIS 10.3.1>
# Import python modules
import arcpy,sys
from arcpy import env
# set the workspace enviroment
env.workspace = r"D:\KKC\Indoor positioning\Ni_Feature\Ni_shp.gdb"
# To aviod an error, set the geoprocessing environment to allow existing data to be overwritten.
env.overwriteOutput = True
# Create a variable with the name of the subject feature class
fcName = "User1_test"
rows = arcpy.UpdateCursor(fcName)
fields = arcpy.ListFields(fcName)
# print out the fields in table
# with arcpy.da.SearchCursor(fcName,["Sheet1__minor"]) as cursor:
for row in rows:
for field in fields:
if fields.getValue(field.Sheet1__minor) == fields.getValue(field.Beacon_47_B1) or fields.getValue(field.Sheet1__minor) == fields.getValue(field.Beacon_47_B2) or fields.getValue(field.Sheet1__minor) == fields.getValue(field.Beacon_47_B3) or fields.getValue(field.Sheet1__minor) == fields.getValue(field.Beacon_47_B4):
if rows.getValue(field.Sheet1__minor) == rows.getValues(field.Sheet1__minor) + 2 :
cursor.deleteRow()
else:
pass
rows.updateRow(row)
else:
pass
-------------------------------------------
Traceback (most recent call last):
File "<module1>", line 30, in <module>
AttributeError: 'list' object has no attribute 'getValue'
------------------------------------------
this is the message. I think i create the list for fields and rows.
Do you have any suggestion?