I have a process where I am making use of spatially enabled data frames, and I wish to drop my dataframe back to a geodatabase (or shapefile).
What is occuring, however, is that I receive the below error message. It seems as though I am having some difficulty writing to a geodatabase (and shapefile, but that's a known issue with nulls) when my dataframe contains null values. Because I've got 50+ columns, and potentially 500,000+ rows, I do not wish to be replacing nulls. In fact, many of those nulls exist with good reason.
So, Has anyone seen this before? Is there a flag that I've missed in the documentation that will allow any field being written to permit nulls (where it might be set to notnullable by default)?
Traceback (most recent call last):
File "<string>", line 272, in execute
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\features\geo\_accessor.py", line 2074, in to_featureclass
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\features\geo\_io\fileops.py", line 688, in to_featureclass
np.apply_along_axis(_insert_row, 1, df[dfcols].values)
File "<__array_function__ internals>", line 6, in apply_along_axis
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\numpy\lib\shape_base.py", line 379, in apply_along_axis
res = asanyarray(func1d(inarr_view[ind0], *args, **kwargs))
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\features\geo\_io\fileops.py", line 685, in _insert_row
RuntimeError: The field is not nullable. [re_id]
Failed to execute (Tool).
Here's the offending piece of code:
#Create file path variable for the Regional Ecosystem 80th Percentile Fuel Lookup Table
messages.addMessage("Loading RE Fuel data csv to dataframe")
inTableREp = parameters.valueAsText
dfRELUT = pd.read_csv(inTableREp)
messages.addMessage("Successfully Read: " + inTableREp)
#Read Pre-Clear Shapefile
messages.addMessage("Reading PreClear Veg table to spatially enabled dataframe")
dfPreClearVeg = pd.DataFrame.spatial.from_featureclass(tmpPreClearAOI)
messages.addMessage("Successfully Read: " + tmpPreClearAOI)
#Merge the datframes together
messages.addMessage("Joining PreClear df RE1 with RE Fuel Lookup Table")
left_merged = dfPreClearVeg.join(
left_merged.spatial.to_featureclass(location=temp_gdb) #Bombs out here
The thing that slays me is that ESRIs own example data on the Introduction to Spatially Enabled Dataframes actually has null values in it.