<?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 GIS() feature item to sdf, where between date and date (ArcGIS API for Python) in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/gis-feature-item-to-sdf-where-between-date-and/m-p/1124981#M63229</link>
    <description>&lt;P&gt;Creating a sedf from an AGOL is relatively straight forward, however, I hit a major stumbling block trying to query dates.&amp;nbsp; I will write four codes blocks following, one that works, and three that don't, to see if somebody can point out my error.&amp;nbsp; Ultimately I need to apply a where clause by the REPORTDATE column.&lt;/P&gt;&lt;P&gt;This code works, with where clause filtering a known CCN:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import pandas as pd
from arcgis.gis import GIS

gis = GIS()
search_result = gis.content.search('title:crashes in dc AND owner:DCGISopendata')
item_crash = search_result[0]
df_crash = item_crash.layers[0].query(where="CCN = '10181486'").sdf
df_crash&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This code does not work:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;...
df_crash = item_crash.layers[0].query(where="REPORTDATE = '2010-12-17 05:00:00'").sdf
...&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Nor does this code using unix time:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;...
df_crash = item_crash.layers[0].query(where="REPORTDATE = 1292562000000").sdf
...&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Nor does this between where clause:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;...
df_crash = item_crash.layers[0].query(where="REPORTDATE BETWEEN 1292562000000 AND 1293512400000").sdf
...&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've been banging my head against the wall on this for a while now.&amp;nbsp; I've tried other permutations of stings, no strings, unix time, iso time.&lt;/P&gt;&lt;P&gt;I have noticed three distinct time formats...AGOL Data shows 12/17/2010, 12:00AM, the arcgis FeatureSet shows unix time 1292562000000 and finally the sedf shows iso&amp;nbsp;&lt;SPAN&gt;2010-12-17 05:00:00.&amp;nbsp; I'm less concerned about GMT versus local and EXACT times and more concerned about a range/between filter, so really would like to get the between working, just thought I would start with equals for testing.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Let me know if you have any pointers.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Tyler&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 10 Dec 2021 18:47:43 GMT</pubDate>
    <dc:creator>TylerTownes</dc:creator>
    <dc:date>2021-12-10T18:47:43Z</dc:date>
    <item>
      <title>GIS() feature item to sdf, where between date and date (ArcGIS API for Python)</title>
      <link>https://community.esri.com/t5/python-questions/gis-feature-item-to-sdf-where-between-date-and/m-p/1124981#M63229</link>
      <description>&lt;P&gt;Creating a sedf from an AGOL is relatively straight forward, however, I hit a major stumbling block trying to query dates.&amp;nbsp; I will write four codes blocks following, one that works, and three that don't, to see if somebody can point out my error.&amp;nbsp; Ultimately I need to apply a where clause by the REPORTDATE column.&lt;/P&gt;&lt;P&gt;This code works, with where clause filtering a known CCN:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import pandas as pd
from arcgis.gis import GIS

gis = GIS()
search_result = gis.content.search('title:crashes in dc AND owner:DCGISopendata')
item_crash = search_result[0]
df_crash = item_crash.layers[0].query(where="CCN = '10181486'").sdf
df_crash&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This code does not work:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;...
df_crash = item_crash.layers[0].query(where="REPORTDATE = '2010-12-17 05:00:00'").sdf
...&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Nor does this code using unix time:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;...
df_crash = item_crash.layers[0].query(where="REPORTDATE = 1292562000000").sdf
...&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Nor does this between where clause:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;...
df_crash = item_crash.layers[0].query(where="REPORTDATE BETWEEN 1292562000000 AND 1293512400000").sdf
...&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've been banging my head against the wall on this for a while now.&amp;nbsp; I've tried other permutations of stings, no strings, unix time, iso time.&lt;/P&gt;&lt;P&gt;I have noticed three distinct time formats...AGOL Data shows 12/17/2010, 12:00AM, the arcgis FeatureSet shows unix time 1292562000000 and finally the sedf shows iso&amp;nbsp;&lt;SPAN&gt;2010-12-17 05:00:00.&amp;nbsp; I'm less concerned about GMT versus local and EXACT times and more concerned about a range/between filter, so really would like to get the between working, just thought I would start with equals for testing.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Let me know if you have any pointers.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Tyler&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Dec 2021 18:47:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/gis-feature-item-to-sdf-where-between-date-and/m-p/1124981#M63229</guid>
      <dc:creator>TylerTownes</dc:creator>
      <dc:date>2021-12-10T18:47:43Z</dc:date>
    </item>
    <item>
      <title>Re: GIS() feature item to sdf, where between date and date (ArcGIS API for Python)</title>
      <link>https://community.esri.com/t5/python-questions/gis-feature-item-to-sdf-where-between-date-and/m-p/1124997#M63231</link>
      <description>&lt;P&gt;Hello Tyler,&lt;/P&gt;&lt;P&gt;I am a bit of a novice at python scripting but I think I may see a typographical error?&amp;nbsp; Seems that you should put the single quotes around the date time attribute as you have it formatted in the first script that you said works?&lt;/P&gt;</description>
      <pubDate>Fri, 10 Dec 2021 19:16:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/gis-feature-item-to-sdf-where-between-date-and/m-p/1124997#M63231</guid>
      <dc:creator>ABishop</dc:creator>
      <dc:date>2021-12-10T19:16:18Z</dc:date>
    </item>
    <item>
      <title>Re: GIS() feature item to sdf, where between date and date (ArcGIS API for Python)</title>
      <link>https://community.esri.com/t5/python-questions/gis-feature-item-to-sdf-where-between-date-and/m-p/1125016#M63232</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/486546"&gt;@ABishop&lt;/a&gt;&amp;nbsp;&amp;nbsp;Unix time is an integer data type I believe, so no quoting should be required, whereas the CCN is a string.&amp;nbsp; The CCN, by the way, was just for testing to ensure my code was working.&amp;nbsp; In any case I had tried quoting the unix time to no avail anyway.&amp;nbsp; Thanks for the observation.&lt;/P&gt;&lt;P&gt;Tyler&lt;/P&gt;</description>
      <pubDate>Fri, 10 Dec 2021 19:45:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/gis-feature-item-to-sdf-where-between-date-and/m-p/1125016#M63232</guid>
      <dc:creator>TylerTownes</dc:creator>
      <dc:date>2021-12-10T19:45:49Z</dc:date>
    </item>
    <item>
      <title>Re: GIS() feature item to sdf, where between date and date (ArcGIS API for Python)</title>
      <link>https://community.esri.com/t5/python-questions/gis-feature-item-to-sdf-where-between-date-and/m-p/1125033#M63233</link>
      <description>&lt;P&gt;Just a hunch... try building this same thing in a definition query window.&amp;nbsp; Or even try replicating this workflow in model builder and then export the code to python script.&amp;nbsp; See if you get the same resutls.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:07:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/gis-feature-item-to-sdf-where-between-date-and/m-p/1125033#M63233</guid>
      <dc:creator>ABishop</dc:creator>
      <dc:date>2021-12-10T20:07:14Z</dc:date>
    </item>
    <item>
      <title>Re: GIS() feature item to sdf, where between date and date (ArcGIS API for Python)</title>
      <link>https://community.esri.com/t5/python-questions/gis-feature-item-to-sdf-where-between-date-and/m-p/1125310#M63237</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Referring to the article&amp;nbsp;&lt;A href="http://SQL reference for query expressions used in ArcGIS" target="_self"&gt;SQL reference for query expressions used in ArcGIS&lt;/A&gt;&amp;nbsp;your query must be like this:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;df_crash = item_crash.layers[0].query(where="REPORTDATE = date '2010-12-17 05:00:00'").sdf&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 13 Dec 2021 06:30:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/gis-feature-item-to-sdf-where-between-date-and/m-p/1125310#M63237</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2021-12-13T06:30:07Z</dc:date>
    </item>
  </channel>
</rss>

