I have a dbf table with four fields: OID,TYPE,FREQUENCY,COUNT.
I only want to keep TYPE. I got this script off this forum and modified it to fit my data but it is not working. Is that because it is a dbf file? It returns the correct fields for the "print field" command. Any other suggesestions?
Thank you in advance
I only want to keep TYPE. I got this script off this forum and modified it to fit my data but it is not working. Is that because it is a dbf file? It returns the correct fields for the "print field" command. Any other suggesestions?
Code:
test_dbf = "C:\\TempData\\testdata.dbf"
data_description = arcpy.Describe(test_dbf)
fields = [f.name for f in data_description.fields if f.type not in ["Geometry", "Raster", "Blob"]]
#fields = [f.name for f in arcpy.ListFields(test_dbf) <> 'Geometry'] # This didn't work either
print fields
for i,f in enumerate(fields):
if f == 'OID' or f == 'FREQUENCY' or f == 'COUNT':
del fields[i]