<?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: Populating dataframe with item search results - values missing in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/populating-dataframe-with-item-search-results/m-p/1383155#M9660</link>
    <description>&lt;P&gt;That syntax works!&lt;/P&gt;&lt;P&gt;Thank you, really appreciate the help.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JillianStanford_0-1708037468963.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/94975i2E555AC8C6D88458/image-size/large?v=v2&amp;amp;px=999" role="button" title="JillianStanford_0-1708037468963.png" alt="JillianStanford_0-1708037468963.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 15 Feb 2024 22:51:35 GMT</pubDate>
    <dc:creator>JillianStanford</dc:creator>
    <dc:date>2024-02-15T22:51:35Z</dc:date>
    <item>
      <title>Populating dataframe with item search results - values missing</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/populating-dataframe-with-item-search-results/m-p/1382953#M9656</link>
      <description>&lt;P&gt;I am stuck on a weird issue.&lt;/P&gt;&lt;P&gt;I am searching for some items, adding them to a pandas dataframe and saving them to a csv.&lt;/P&gt;&lt;P&gt;This is all working except that the size value is only populated for the first item.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JillianStanford_1-1708018480454.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/94913iCECC32F1949A3052/image-size/large?v=v2&amp;amp;px=999" role="button" title="JillianStanford_1-1708018480454.png" alt="JillianStanford_1-1708018480454.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I can inspect the size property for each item and see that it has a value. In fact, once I access the size property, it shows up in the dataframe.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JillianStanford_2-1708018673704.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/94914i30CE49FC65E6896D/image-size/large?v=v2&amp;amp;px=999" role="button" title="JillianStanford_2-1708018673704.png" alt="JillianStanford_2-1708018673704.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Why does this happen and what is the workaround?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2024 17:46:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/populating-dataframe-with-item-search-results/m-p/1382953#M9656</guid>
      <dc:creator>JillianStanford</dc:creator>
      <dc:date>2024-02-15T17:46:54Z</dc:date>
    </item>
    <item>
      <title>Re: Populating dataframe with item search results - values missing</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/populating-dataframe-with-item-search-results/m-p/1383105#M9657</link>
      <description>&lt;P&gt;items is a list of objects - sometimes this will work, sometimes not. The dictionary representation of the data is more reliable.&lt;/P&gt;&lt;P&gt;There are many ways to fix this, but the most straightforward is probably to do:&lt;/P&gt;&lt;PRE&gt;df = pd.DataFrame([vars(item) for item in items], columns=["id", "size", "type"])&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;vars() is&amp;nbsp; just a handy function that returns the&amp;nbsp;&lt;SPAN&gt;__dict__ attribute on each item object.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2024 20:44:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/populating-dataframe-with-item-search-results/m-p/1383105#M9657</guid>
      <dc:creator>EarlMedina</dc:creator>
      <dc:date>2024-02-15T20:44:15Z</dc:date>
    </item>
    <item>
      <title>Re: Populating dataframe with item search results - values missing</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/populating-dataframe-with-item-search-results/m-p/1383113#M9658</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thank you so much for your reply.&lt;/P&gt;&lt;P&gt;When I use this method of populating the dataframe, I don't get the size populated at all, not even in the first row.&lt;/P&gt;&lt;P&gt;I will look more at accessing the dictionary, instead of the object.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JillianStanford_0-1708030083316.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/94966i1E64E15BDF7AA598/image-size/large?v=v2&amp;amp;px=999" role="button" title="JillianStanford_0-1708030083316.png" alt="JillianStanford_0-1708030083316.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2024 20:49:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/populating-dataframe-with-item-search-results/m-p/1383113#M9658</guid>
      <dc:creator>JillianStanford</dc:creator>
      <dc:date>2024-02-15T20:49:28Z</dc:date>
    </item>
    <item>
      <title>Re: Populating dataframe with item search results - values missing</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/populating-dataframe-with-item-search-results/m-p/1383130#M9659</link>
      <description>&lt;P&gt;I'm not sure why this doesn't work for you? I can reproduce your original issue and the fix works on my end.&lt;/P&gt;&lt;P&gt;You can also try&lt;/P&gt;&lt;PRE&gt;df = pd.DataFrame([{"id": item.id, "size": item.size, "type": item.type} for item in items])&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This also works for me.&lt;/P&gt;&lt;P&gt;My version of the python api is 2.3.0; the version of pandas is 2.0.2.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2024 21:29:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/populating-dataframe-with-item-search-results/m-p/1383130#M9659</guid>
      <dc:creator>EarlMedina</dc:creator>
      <dc:date>2024-02-15T21:29:45Z</dc:date>
    </item>
    <item>
      <title>Re: Populating dataframe with item search results - values missing</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/populating-dataframe-with-item-search-results/m-p/1383155#M9660</link>
      <description>&lt;P&gt;That syntax works!&lt;/P&gt;&lt;P&gt;Thank you, really appreciate the help.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JillianStanford_0-1708037468963.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/94975i2E555AC8C6D88458/image-size/large?v=v2&amp;amp;px=999" role="button" title="JillianStanford_0-1708037468963.png" alt="JillianStanford_0-1708037468963.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2024 22:51:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/populating-dataframe-with-item-search-results/m-p/1383155#M9660</guid>
      <dc:creator>JillianStanford</dc:creator>
      <dc:date>2024-02-15T22:51:35Z</dc:date>
    </item>
    <item>
      <title>Re: Populating dataframe with item search results - values missing</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/populating-dataframe-with-item-search-results/m-p/1384627#M9670</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/86309"&gt;@EarlMedina&lt;/a&gt;- A follow up question...&lt;/P&gt;&lt;P&gt;I integrated your syntax for creating the dataframe from query results into my script and it kind of works but accessing the size property takes forever.&lt;/P&gt;&lt;P&gt;In this example, I'm querying ArcGIS Online content and dumping it into a dataframe. If I leave out size, it takes 3 seconds. If I include size, it takes 24 minutes.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JillianStanford_0-1708464064562.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/95311iA7EE9E121F15C139/image-size/large?v=v2&amp;amp;px=999" role="button" title="JillianStanford_0-1708464064562.png" alt="JillianStanford_0-1708464064562.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I ran this against an ArcGIS Enterprise org and I finally had to kill the script after 4 hours. It never finished and never generated an error.&lt;/P&gt;&lt;P&gt;Any ideas for a workaround? Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2024 21:28:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/populating-dataframe-with-item-search-results/m-p/1384627#M9670</guid>
      <dc:creator>JillianStanford</dc:creator>
      <dc:date>2024-02-20T21:28:43Z</dc:date>
    </item>
    <item>
      <title>Re: Populating dataframe with item search results - values missing</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/populating-dataframe-with-item-search-results/m-p/1384690#M9671</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/86115"&gt;@JillianStanford&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;It looks like that property isn't there by default. You can try hydrating each item object ahead of time as this seems to set the required size property. So, you would do something like this first:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;for item in items:
    item._hydrate()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2024 23:40:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/populating-dataframe-with-item-search-results/m-p/1384690#M9671</guid>
      <dc:creator>EarlMedina</dc:creator>
      <dc:date>2024-02-20T23:40:49Z</dc:date>
    </item>
    <item>
      <title>Re: Populating dataframe with item search results - values missing</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/populating-dataframe-with-item-search-results/m-p/1385070#M9674</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Calling the _hydrate method didn't seem to do the trick. The code block still took 24 minutes.&lt;/P&gt;&lt;P&gt;I inspected the network traffic and I didn't realize that certain properties weren't returned by a search and that a subsequent request was required to retrieve them. It makes sense to me now why it takes so long and I can't think of a workaround. Even if I was accessing the REST endpoint directly, there is an "&lt;SPAN class=""&gt;exclude&lt;/SPAN&gt;" fields parameter but not an "include" fields parameter.&lt;/P&gt;&lt;P&gt;Thanks for your help!&lt;/P&gt;&lt;P&gt;Jill&lt;/P&gt;</description>
      <pubDate>Wed, 21 Feb 2024 19:29:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/populating-dataframe-with-item-search-results/m-p/1385070#M9674</guid>
      <dc:creator>JillianStanford</dc:creator>
      <dc:date>2024-02-21T19:29:07Z</dc:date>
    </item>
  </channel>
</rss>

