However, it will not loop anymore
FIPSlist = ('001', '003', '005') for fip in FIPSlist: query = "FIPS_PARIS ='" + fip + "'" arcpy.TableSelect_analysis("Master_TAHI", FIPS + r"\FIPS" + fip + ".dbf",query)
How can i represend in arcmap the value max?
import arcpy myOutputTable = r"C:\temp\test.gdb\input" for i in range(1,1001): myOutputTable = r"C:\temp\test.gdb\table_id_" + str(i) arcpy.TableSelect_analysis(myInputTable, myOutputTable, "MY_ID = " + str(i))
I'm new to Python and what I want to do is very similar, only my list is of integer values (created by using range()). Using the above example, how would the query expression be changed if FIPSlist was integer instead of string (query field is also integer)?
FIPSlist = range(5) # (0,1,2,3,4) for fip in FIPSlist: query = "FIPS_PARIS = " + str(fip) arcpy.TableSelect_analysis("Master_TAHI", FIPSpath + r"\FIPS" + str(fip) + ".dbf",query)
import arcpy FIPS = "C:\\Users\\D2148\\Documents\\Maps\\FIPS" FIPSlist = ('001', '003', '005', '007', '009', '011', '013', '015', '017', '019', '021', '023', '025', '027', '029', '031', '033', '035', '037', '039', '041', '043', '045', '047', '049', '051', '053', '055', '057', '059', '061', '063', '065', '067', '069', '071', '073', '075', '077', '079', '081', '083', '085', '087', '089', '091', '093', '095', '097', '099', '101', '103', '105', '107', '109', '111', '113', '115', '117', '119', '121', '123', '125', '127') for fip in FIPSlist: query = "FIPS_PARIS ='" + fip + "'" arcpy.TableSelect_analysis("Master_TAHI", FIPS + "\\FIPS" + fip + ".dbf",query)
import arcpy FIPS = "C:\\Users\\D2148\\Documents\\Maps\\FIPS" c = 0 # FIPSlist = ('001', '003', '005', '007', '009', '011', '013', #Try smaller list first #'015', '017', '019', '021', '023', '025', '027', #'029', '031', '033', '035', '037', '039', '041', #'043', '045', '047', '049', '051', '053', '055', #'057', '059', '061', '063', '065', '067', '069', #'071', '073', '075', '077', '079', '081', '083', #'085', '087', '089', '091', '093', '095', '097', #'099', '101', '103', '105', '107', '109', '111', #'113', '115', '117', '119', '121', '123', '125', #'127') #FIPSnum = (001, 003, 005, 007, 009, 011, 013, #Try Smaller list first # 015, 017, 019, 021, 023, 025, 027, # 029, 031, 033, 035, 037, 039, 041, # 043, 045, 047, 049, 051, 053, 055, # 057, 059, 061, 063, 065, 067, 069, # 071, 073, 075, 077, 079, 081, 083, # 085, 087, 089, 091, 093, 095, 097, # 099, 101, 103, 105, 107, 109, 111, # 113, 115, 117, 119, 121, 123, 125, # 127) FIPSlist = ('001', '003', '005') FIPSnum = (001, 003, 005) while c < len(FIPSlist): for fip in FIPSlist: query = "FIPS_PARIS ='" + fip + "'" # arcpy.TableToTable_conversion("TRIAL1",FIPS,"FIPS" + FIPSlist + ".dbf",query) arcpy.TableSelect_analysis("Master_TAHI", FIPS + "\\FIPS" + FIPSlist + ".dbf",query) c = c + 1
Still having problems with the where clause. The select features will not go through the list loop. It only wants to find the list name since it is in quotes.I just can't figure this out.
arcpy.TableSelect_analysis(inputTable, outputWorkspace +\ "\\fips_" + str(fip) + ".dbf", \ "FIPS_PARIS = " + "\'" + fip + "\'")
query = "FIPS_PARIS = \'%s\'" % fip outTable = os.path.join(outputWorkspace,"fips_%s.dbf" % fip) arcpy.TableSelect_analysis(inputTable,outTable,query)
query = "FIPS_PARIS = \'{0}\'".format(fip) outTable = os.path.join(outputWorkspace,"fips_{0}.dbf".format(fip) arcpy.TableSelect_analysis(inputTable,outTable, query)
"FIPS_PARIS = '" + fip + "'"
How about:inputTable = r"C:\temp\test\mytable.dbf" outputWorkspace = r"C:\temp\test" fipsLlist = ['001', '003', '005', '007', '009', '011', '013', '015', '017', '019', '021', '023', '025', '027', '029', '031', '033', '035', '037', '039', '041', '043', '045', '047', '049', '051', '053', '055', '057', '059', '061', '063', '065', '067', '069', '071', '073', '075', '077', '079', '081', '083', '085', '087', '089', '091', '093', '095', '097', '099', '101', '103', '105', '107', '109', '111', '113', '115', '117', '119', '121', '123', '125', '127'] for fip in fipsList: arcpy.TableSelect_analysis(inputTable, outputWorkspace + "\\fips_" + str(fip) + ".dbf", ","FIPS_PARIS = " + "'" + fip + "'")
inputTable = r"C:\temp\test\mytable.dbf" outputWorkspace = r"C:\temp\test" fipsLlist = ['001', '003', '005', '007', '009', '011', '013', '015', '017', '019', '021', '023', '025', '027', '029', '031', '033', '035', '037', '039', '041', '043', '045', '047', '049', '051', '053', '055', '057', '059', '061', '063', '065', '067', '069', '071', '073', '075', '077', '079', '081', '083', '085', '087', '089', '091', '093', '095', '097', '099', '101', '103', '105', '107', '109', '111', '113', '115', '117', '119', '121', '123', '125', '127'] for fip in fipsList: arcpy.TableSelect_analysis(inputTable, outputWorkspace + "\\fips_" + str(fip) + ".dbf", ","FIPS_PARIS = " + "'" + fip + "'")
. I am having a problem executing this file. It keeps saying there is a error. The maximum record length has been exceeded. The file only has 87000 records.
Field names cannot be longer than 10 characters.The maximum record length for an attribute is 4,000 bytes. The record length is the number of bytes used to define all the fields, not the number of bytes used to store the actual values.The maximum number of fields is 255. A conversion to shapefile will convert the first 255 fields if this limit is exceeded.The dBASE file must contain at least one field. When you create a new shapefile or dBASE table, an integer ID field is created as a default.dBASE files do not support type blob, guid, global ID, coordinate ID, or raster field types.dBASE files have little SQL support aside from a WHERE clause.Attribute indexes are deleted when you save edits, and you must re-create them from scratch.Arc 10 Help: Geoprocessing considerations for shapefile output
for i in range(1,129,2): fipString=str(i).zfill(3) arcpy.TableToTable_conversion("Master_TAHI", "C:\\Users\\D2148\\Documents\\Maps\\Parish Roads\\TAHI_LRS\\Parish_roads\\TAHI_parish\\FIPS", "FIPS%s.dbf" % fipString, "\"FIPS PARIS\" = '%s'" % fipString)
Membros conectados podem postar, seguir atualizações e mais. Novo aqui? Registre uma conta gratuita.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.