<?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: *** TypeError: Expected String or Unicode when loading SHP to Spatially-Enabled Data Frame in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/typeerror-expected-string-or-unicode-when-loading/m-p/1286496#M26854</link>
    <description>&lt;P&gt;Have you tried without explicitly requesting the SHAPE field?&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# fields I want to include in SEDF
fields2use = ['A', 'B', 'CAPCLASS', 'LANES', 'SPEED']&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 07 May 2023 02:07:08 GMT</pubDate>
    <dc:creator>Luke_Pinner</dc:creator>
    <dc:date>2023-05-07T02:07:08Z</dc:date>
    <item>
      <title>*** TypeError: Expected String or Unicode when loading SHP to Spatially-Enabled Data Frame</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/typeerror-expected-string-or-unicode-when-loading/m-p/1286493#M26853</link>
      <description>&lt;P&gt;I'm trying to load a very wide (145 fields) feature class, and to save memory, I want to only load in 6 of the fields. Following the documentation for the &lt;A href="https://developers.arcgis.com/python/api-reference/arcgis.features.toc.html#arcgis.features.GeoAccessor.from_featureclass" target="_self"&gt;from_featureclass()&lt;/A&gt; method, I tried specifying the fields I wanted using the &lt;FONT face="courier new,courier"&gt;fields &lt;/FONT&gt;parameter.&lt;/P&gt;&lt;P&gt;However, when I specify the &lt;FONT face="courier new,courier"&gt;fields&lt;/FONT&gt; parameter, I get the error &lt;FONT face="courier new,courier"&gt;*** TypeError: Expected String or Unicode.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Then, if I remove the &lt;FONT face="courier new,courier"&gt;fields&lt;/FONT&gt; parameter, the error goes away and the feature class loads successfully.&lt;/P&gt;&lt;P&gt;Has anyone else had this issue? Example code is below. *Notably*, I have tried both with a shapefile and with a feature class in a FGDB, and get the same error with both file types&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# fields I want to include in SEDF
fields2use = ['A', 'B', 'CAPCLASS', 'LANES', 'SHAPE', 'SPEED']

# *Successful* loading when NOT specifying the fields parameter
sedf_hwy = pd.DataFrame.spatial.from_featureclass(self.fc_daynet, where_clause=where_sql, sr=self.crs_sacog)

# *Failed* loading when trying to load while specifying fields parameter.
sedf_hwy = pd.DataFrame.spatial.from_featureclass(self.fc_daynet, fields=fields2use, where_clause=where_sql, sr=self.crs_sacog)
# result: *** TypeError: Expected String or Unicode&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 07 May 2023 00:36:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/typeerror-expected-string-or-unicode-when-loading/m-p/1286493#M26853</guid>
      <dc:creator>DarrenConly</dc:creator>
      <dc:date>2023-05-07T00:36:05Z</dc:date>
    </item>
    <item>
      <title>Re: *** TypeError: Expected String or Unicode when loading SHP to Spatially-Enabled Data Frame</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/typeerror-expected-string-or-unicode-when-loading/m-p/1286496#M26854</link>
      <description>&lt;P&gt;Have you tried without explicitly requesting the SHAPE field?&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# fields I want to include in SEDF
fields2use = ['A', 'B', 'CAPCLASS', 'LANES', 'SPEED']&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 07 May 2023 02:07:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/typeerror-expected-string-or-unicode-when-loading/m-p/1286496#M26854</guid>
      <dc:creator>Luke_Pinner</dc:creator>
      <dc:date>2023-05-07T02:07:08Z</dc:date>
    </item>
    <item>
      <title>Re: *** TypeError: Expected String or Unicode when loading SHP to Spatially-Enabled Data Frame</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/typeerror-expected-string-or-unicode-when-loading/m-p/1286497#M26855</link>
      <description>&lt;P&gt;Thanks &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/10780"&gt;@Luke_Pinner&lt;/a&gt;! That fixed it. I'm used to filtering columns &lt;EM&gt;after&lt;/EM&gt; completely loading the dataframe, so if you don't specify the SHAPE field it removes the geometry from the df. But since fields are specified before creating the spatial dataframe, it makes sense you shouldn't be specifying it.&lt;/P&gt;&lt;P&gt;That said ESRI **r&lt;STRONG&gt;eally**&lt;/STRONG&gt; should make the error message clearer. E.g., instead of saying some generic TypeError message, the error should say something like "field 'SHAPE' not found in source file" or something like that.&lt;/P&gt;</description>
      <pubDate>Sun, 07 May 2023 02:47:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/typeerror-expected-string-or-unicode-when-loading/m-p/1286497#M26855</guid>
      <dc:creator>DarrenConly</dc:creator>
      <dc:date>2023-05-07T02:47:58Z</dc:date>
    </item>
  </channel>
</rss>

