<?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 What is wrong with my spatial.to_featureclass() syntax? in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/what-is-wrong-with-my-spatial-to-featureclass/m-p/810872#M2447</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to use Pandas data frames to filter features as using the equivalent geoprocessing tools (select, append) take multiple hours to run. The script reads in my feature class just fine, but outputting to a new feature class produces the following error:&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN class="" style="color: #e75c58; font-weight: bold;"&gt;ValueError&lt;/SPAN&gt;: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;intersectionsSdf = pd.DataFrame.spatial.from_featureclass(intersections)

selection = intersectionsSdf.loc[intersectionsSdf[sc].isin(verifiedSites)]

selection.spatial.to_featureclass(r'MYPATH\MYGDB.gdb\VerifiedSelectionLayer', overwrite=True)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Note: 'verifiedSites' is just a list of integers- this seems to not be a problem as printing the dataframe works fine, but outputting to an FC fails&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can someone help me troubleshoot this? As far as I can tell it may be something to do with the ordering of my inputs? It ran one time with no errors, but I cannot reproduce this result&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 16:57:01 GMT</pubDate>
    <dc:creator>Matthew_Williams</dc:creator>
    <dc:date>2021-12-12T16:57:01Z</dc:date>
    <item>
      <title>What is wrong with my spatial.to_featureclass() syntax?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/what-is-wrong-with-my-spatial-to-featureclass/m-p/810872#M2447</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to use Pandas data frames to filter features as using the equivalent geoprocessing tools (select, append) take multiple hours to run. The script reads in my feature class just fine, but outputting to a new feature class produces the following error:&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN class="" style="color: #e75c58; font-weight: bold;"&gt;ValueError&lt;/SPAN&gt;: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;intersectionsSdf = pd.DataFrame.spatial.from_featureclass(intersections)

selection = intersectionsSdf.loc[intersectionsSdf[sc].isin(verifiedSites)]

selection.spatial.to_featureclass(r'MYPATH\MYGDB.gdb\VerifiedSelectionLayer', overwrite=True)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Note: 'verifiedSites' is just a list of integers- this seems to not be a problem as printing the dataframe works fine, but outputting to an FC fails&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can someone help me troubleshoot this? As far as I can tell it may be something to do with the ordering of my inputs? It ran one time with no errors, but I cannot reproduce this result&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:57:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/what-is-wrong-with-my-spatial-to-featureclass/m-p/810872#M2447</guid>
      <dc:creator>Matthew_Williams</dc:creator>
      <dc:date>2021-12-12T16:57:01Z</dc:date>
    </item>
    <item>
      <title>Re: What is wrong with my spatial.to_featureclass() syntax?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/what-is-wrong-with-my-spatial-to-featureclass/m-p/810873#M2448</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are comparing many to many, but without a proper array formulation, you can run into problems&lt;/P&gt;&lt;P&gt;You might want to test for inclusion on an elemental basis prior to the slice on the second line so emulate the following between lines 1 and 2&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;a &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;3&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;4&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;5&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;

b &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;3&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# ---- the wrong way&lt;/SPAN&gt;

b &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; a
&lt;SPAN class="token boolean"&gt;False&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# ---- the safe way&lt;/SPAN&gt;
is_in &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;i &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; i &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; b &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; i &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; a&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;3&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 09:31:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/what-is-wrong-with-my-spatial-to-featureclass/m-p/810873#M2448</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-12T09:31:17Z</dc:date>
    </item>
    <item>
      <title>Re: What is wrong with my spatial.to_featureclass() syntax?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/what-is-wrong-with-my-spatial-to-featureclass/m-p/810874#M2449</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dan- thanks very much for your reply. To clarify, does line 11 essentially say "is_in is equal to i for i in b, but only if i is also in a"?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The issue doesn't seem to be the creation of the dataframe- I can print 'selection' with no issues. It seems to arise only when I try to output that frame to a feature class... could the be an issue with saving to a geodatabase rather than a shapefile?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Nov 2019 17:45:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/what-is-wrong-with-my-spatial-to-featureclass/m-p/810874#M2449</guid>
      <dc:creator>Matthew_Williams</dc:creator>
      <dc:date>2019-11-12T17:45:55Z</dc:date>
    </item>
  </channel>
</rss>

