One of my scripts uses arcpy.da.NumPyArrayToTable. I ran this script about 2 years ago without incident. Now, it is throwing the error:
RuntimeError: create table
This is the output of the print statement of my array that I'm trying to copy over to a table:
array([('S1', 'G5', 3778, 14702, 'PDSAL02240', 'Salix pedicellaris', 'Bog Willow', None, None, 'Y', None, 'N', 'PE', None, None, None, None, 'N', 'EXCLUDE from ER per DCNR 2019-01-02 (P19BOW01).', None, None, None, None, None, '28-Feb-22', 'G5', 'S1', 'in biotics', 'G5', 'S1', 0.6, 0.008, 0.33333333),
('S1', 'G3G5', 7384, 478722, 'NBMUS1A1B0', 'Ptychostomum cernuum', None, None, None, 'Y', None, None, None, None, None, None, None, 'N', None, None, None, None, None, None, '28-Feb-22', 'G4', 'S1', None, 'G4', 'S1', 0.7, 0. , nan),
...,
('SX', 'G4G5', 4113, 15067, 'PMCYP036C0', 'Carex hyalinolepis', 'Shore-line Sedge', None, None, 'Y', None, 'PX', 'PX', None, None, None, None, 'N', None, None, None, None, None, None, '28-Feb-22', 'G4', 'SX', 'in biotics', 'G4', 'SX', 0. , 0. , nan),
dtype=(numpy.record, [('SRANK', '<U4'), ('GRANK', '<U9'), ('OBJECTID', '<i4'), ('ELSUBID', '<i4'), ('ELCODE', '<U10'), ('SNAME', '<U46'), ('SCOMNAME', 'O'), ('SRANK_CHGD', 'O'), ('SRANK_RVWD', 'O'), ('EO_TRACK', 'O'), ('USESA', 'O'), ('SPROT', 'O'), ('PBSSTATUS', 'O'), ('PBSDATE', 'O'), ('PBSQUAL', 'O'), ('SGCN', 'O'), ('SGCN_COM', 'O'), ('SENSITV_SP', '<U1'), ('ER_RULE', 'O'), ('MOD_BY', 'O'), ('MOD_DATE', 'O'), ('CHG_TYPE', 'O'), ('CHG_INFO', 'O'), ('CHG_SRC', 'O'), ('EXPT_DATE', '<U9'), ('Rounded_GRANK', 'O'), ('Rounded_SRANK', '<U3'), ('temp_taxostatus', 'O'), ('GRANK_rounded', '<U3'), ('SRANK_rounded', '<U3'), ('rank_score', '<f8'), ('resp_score', '<f8'), ('rarity_score', '<f8')]))
Just checking to see if anyone can see any issues in the array that might be throwing this error or if anyone has any other ideas about what I can try to do to fix the issue. Thanks!
Hello Molly,
I am no expert in arrays, but I found this thread that may offer some help for your issue.
format issues. and really long lines but, here you go.
dt = [('SRANK', '<U4'), ('GRANK', '<U9'), ('OBJECTID', '<i4'),
('ELSUBID', '<i4'), ('ELCODE', '<U10'), ('SNAME', '<U46'),
('SCOMNAME', 'O'), ('SRANK_CHGD', 'O'), ('SRANK_RVWD', 'O'),
('EO_TRACK', 'O'), ('USESA', 'O'), ('SPROT', 'O'), ('PBSSTATUS', 'O'),
('PBSDATE', 'O'), ('PBSQUAL', 'O'), ('SGCN', 'O'), ('SGCN_COM', 'O'),
('SENSITV_SP', '<U1'), ('ER_RULE', 'O'), ('MOD_BY', 'O'),
('MOD_DATE', 'O'), ('CHG_TYPE', 'O'), ('CHG_INFO', 'O'),
('CHG_SRC', 'O'), ('EXPT_DATE', '<U9'), ('Rounded_GRANK', 'O'),
('Rounded_SRANK', '<U3'), ('temp_taxostatus', 'O'),
('GRANK_rounded', '<U3'), ('SRANK_rounded', '<U3'),
('rank_score', '<f8'), ('resp_score', '<f8'), ('rarity_score', '<f8')]
z = np.array([
('S1', 'G5', 3778, 14702, 'PDSAL02240', 'Salix pedicellaris',
'Bog Willow', None, None, 'Y', None, 'N', 'PE',
None, None, None, None, 'N',
'EXCLUDE from ER per DCNR 2019-01-02 (P19BOW01).',
None, None, None, None, None, '28-Feb-22', 'G5', 'S1',
'in biotics', 'G5', 'S1', 0.6, 0.008, 0.33333333),
('S1', 'G3G5', 7384, 478722, 'NBMUS1A1B0', 'Ptychostomum cernuum',
None, None, None, 'Y', None, None, None, None, None, None, None,
'N', None, None, None, None, None, None, '28-Feb-22', 'G4', 'S1',
None, 'G4', 'S1', 0.7, 0., np.nan),
('SX', 'G4G5', 4113, 15067, 'PMCYP036C0', 'Carex hyalinolepis',
'Shore-line Sedge', None, None, 'Y', None, 'PX', 'PX', None, None,
None, None, 'N', None, None, None, None, None, None, '28-Feb-22',
'G4', 'SX', 'in biotics', 'G4', 'SX', 0., 0., np.nan)],
dtype=dt)
# --- an example
z['resp_score']
array([ 0.01, 0.00, 0.00])