<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: System Error when exporting Spatially Enabled DataFrame to Feature Class in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/system-error-when-exporting-spatially-enabled/m-p/1206944#M7684</link>
    <description>&lt;P&gt;Hello nzjs,&lt;BR /&gt;&lt;BR /&gt;Does this function still work for you? I'm on Pro 3.0 and have a dataframe representing all the content within a group using the Group Object search method using&amp;nbsp;search(query='type:web map', as_dict = True) and converting this to a dataframe. I then expand the 'results' key to additional columns with pd.series and it kicks out a ton of dtypes as objects. However when I run your function it doesn't do anything.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 26 Aug 2022 21:52:21 GMT</pubDate>
    <dc:creator>RoderickPerendy</dc:creator>
    <dc:date>2022-08-26T21:52:21Z</dc:date>
    <item>
      <title>System Error when exporting Spatially Enabled DataFrame to Feature Class</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/system-error-when-exporting-spatially-enabled/m-p/1044880#M5900</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I'm trying to do the following:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Convert a non-spatial pandas dataframe to a spatial dataframe&lt;/LI&gt;&lt;LI&gt;Export the spatial dataframe to a feature class in an ESRI file geodatabase, based on the instructions provided in ESRI's &lt;A href="https://developers.arcgis.com/python/guide/introduction-to-the-spatially-enabled-dataframe/" target="_self"&gt;Introduction to the Spatially Enabled DataFrame&lt;/A&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I get the error "SystemError: &amp;lt;da.funcInfo object at 0x0000029FA43C52A0&amp;gt; returned NULL without setting an error".&lt;/P&gt;&lt;P&gt;I googled the error and the only hits I got implied the issue has something to do with making a C extension. Do any of you have any insights on this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the full code for context:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;out_fc_path = 'I:\\Projects\\Darren\\EmpInventory\\EmploymentInventory.gdb\\testrecs9581720210407_1435'

sdft = GeoAccessor.from_xy(master_df, fld_lat, fld_lon) # no issues here!

sdft.spatial.to_featureclass(location=out_fc_path)
Traceback (most recent call last):

  File "&amp;lt;ipython-input-29-2e5a93021399&amp;gt;", line 1, in &amp;lt;module&amp;gt;
    sdft.spatial.to_featureclass(location=out_fc_path)

  File "C:\Users\dconly\AppData\Local\ESRI\conda\envs\arcgispro-py3-dcmar21\lib\site-packages\arcgis\features\geo\_accessor.py", line 2122, in to_featureclass
    has_m=has_m)

  File "C:\Users\dconly\AppData\Local\ESRI\conda\envs\arcgispro-py3-dcmar21\lib\site-packages\arcgis\features\geo\_io\fileops.py", line 708, in to_featureclass
    arcpy.da.ExtendTable(fc, oidfld, array, join_dummy, append_only=False)

SystemError: &amp;lt;da.funcInfo object at 0x0000029FA43C52A0&amp;gt; returned NULL without setting an error&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Apr 2021 22:07:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/system-error-when-exporting-spatially-enabled/m-p/1044880#M5900</guid>
      <dc:creator>DarrenConly</dc:creator>
      <dc:date>2021-04-07T22:07:26Z</dc:date>
    </item>
    <item>
      <title>Re: System Error when exporting Spatially Enabled DataFrame to Feature Class</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/system-error-when-exporting-spatially-enabled/m-p/1044899#M5901</link>
      <description>&lt;P&gt;I found the solution!&lt;/P&gt;&lt;P&gt;In trying to find a workaround, I discovered that you cannot export a spatial dataframe to a file or feature class if it contains categorical data types. To fix this, you must convert all categorical data types to string data type.&lt;/P&gt;&lt;P&gt;Example: if you have a column 'X' that is categorical, you must first convert to string data type by doing the following:&lt;/P&gt;&lt;P&gt;df['X'] = df['X'].astype('str')&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm happy to have resolved this, and hope my solution is informative to others.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;</description>
      <pubDate>Wed, 07 Apr 2021 23:03:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/system-error-when-exporting-spatially-enabled/m-p/1044899#M5901</guid>
      <dc:creator>DarrenConly</dc:creator>
      <dc:date>2021-04-07T23:03:57Z</dc:date>
    </item>
    <item>
      <title>Re: System Error when exporting Spatially Enabled DataFrame to Feature Class</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/system-error-when-exporting-spatially-enabled/m-p/1063942#M6159</link>
      <description>&lt;P&gt;Darren, this led me in the right direction to solve similar issue. In my case I had a number of seemingly invalid data types, so this small function fixed it.&lt;/P&gt;&lt;P&gt;Cheers, John&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def convert_dtypes_arcgis(df):
  # Convert dataframe dtypes which are not compatible with ArcGIS
  # Use builtin Pandas dtype conversion
  df = df.convert_dtypes(infer_objects=True)
  # Then str convert any remaining special object/category fields 
  for col in df.columns:
    # print(col, '/', df[col].dtype)
    if df[col].dtype == 'object' or df[col].dtype == 'category':
      df[col] = df[col].astype('str')
  # Return modified df
  return df&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jun 2021 04:20:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/system-error-when-exporting-spatially-enabled/m-p/1063942#M6159</guid>
      <dc:creator>nzjs</dc:creator>
      <dc:date>2021-06-02T04:20:32Z</dc:date>
    </item>
    <item>
      <title>Re: System Error when exporting Spatially Enabled DataFrame to Feature Class</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/system-error-when-exporting-spatially-enabled/m-p/1063950#M6160</link>
      <description>&lt;P&gt;Thanks for posting the solution&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jun 2021 05:16:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/system-error-when-exporting-spatially-enabled/m-p/1063950#M6160</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-06-02T05:16:22Z</dc:date>
    </item>
    <item>
      <title>Re: System Error when exporting Spatially Enabled DataFrame to Feature Class</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/system-error-when-exporting-spatially-enabled/m-p/1070967#M6243</link>
      <description>&lt;P&gt;@Anonymous User&amp;nbsp;is this going to become a built-in for the API? I recently ran into this issue and am glad there's a workaround, but this seems to be a pretty significant defect.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jun 2021 14:32:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/system-error-when-exporting-spatially-enabled/m-p/1070967#M6243</guid>
      <dc:creator>feralcatcolonist_old</dc:creator>
      <dc:date>2021-06-22T14:32:29Z</dc:date>
    </item>
    <item>
      <title>Re: System Error when exporting Spatially Enabled DataFrame to Feature Class</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/system-error-when-exporting-spatially-enabled/m-p/1206944#M7684</link>
      <description>&lt;P&gt;Hello nzjs,&lt;BR /&gt;&lt;BR /&gt;Does this function still work for you? I'm on Pro 3.0 and have a dataframe representing all the content within a group using the Group Object search method using&amp;nbsp;search(query='type:web map', as_dict = True) and converting this to a dataframe. I then expand the 'results' key to additional columns with pd.series and it kicks out a ton of dtypes as objects. However when I run your function it doesn't do anything.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Aug 2022 21:52:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/system-error-when-exporting-spatially-enabled/m-p/1206944#M7684</guid>
      <dc:creator>RoderickPerendy</dc:creator>
      <dc:date>2022-08-26T21:52:21Z</dc:date>
    </item>
  </channel>
</rss>

