<?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: Selecting Consecutive Rows in a Feature Class in Python in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/selecting-consecutive-rows-in-a-feature-class-in/m-p/194597#M14937</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hey Tommy,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In your example of Hour &amp;lt; 6 and you want the next value, would you say your have unique values, or do you want a list of unique values, then create ranges off of that list?&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If that is the case, try using the Fequency tool set and set the field to the Hour field or whatever field you want the unique list of values to.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can then use a search cursor on that table to get a complete list of values and easily select the next lowest value by sorting your list.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 25 Jan 2012 15:57:01 GMT</pubDate>
    <dc:creator>AndrewChapkowski</dc:creator>
    <dc:date>2012-01-25T15:57:01Z</dc:date>
    <item>
      <title>Selecting Consecutive Rows in a Feature Class in Python</title>
      <link>https://community.esri.com/t5/python-questions/selecting-consecutive-rows-in-a-feature-class-in/m-p/194596#M14936</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am trying to find a piece of python code that will select consecutive rows in a feature class. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I want to select all features in a feature class where a field is less than 6 (Hours &amp;lt; 6). I can do this part. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I then want to select the next feature below each of those that are less than 6, no matter what it's field value is, so I can get a start and end point. I have tried using the search cursor, but I'm not real familiar with how it works. Is there a bit of code that would accomplish what I'm trying to do? Thanks for any help!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Tommy Burk&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Jan 2012 13:23:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/selecting-consecutive-rows-in-a-feature-class-in/m-p/194596#M14936</guid>
      <dc:creator>TommyBurk</dc:creator>
      <dc:date>2012-01-25T13:23:54Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting Consecutive Rows in a Feature Class in Python</title>
      <link>https://community.esri.com/t5/python-questions/selecting-consecutive-rows-in-a-feature-class-in/m-p/194597#M14937</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hey Tommy,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In your example of Hour &amp;lt; 6 and you want the next value, would you say your have unique values, or do you want a list of unique values, then create ranges off of that list?&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If that is the case, try using the Fequency tool set and set the field to the Hour field or whatever field you want the unique list of values to.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can then use a search cursor on that table to get a complete list of values and easily select the next lowest value by sorting your list.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Jan 2012 15:57:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/selecting-consecutive-rows-in-a-feature-class-in/m-p/194597#M14937</guid>
      <dc:creator>AndrewChapkowski</dc:creator>
      <dc:date>2012-01-25T15:57:01Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting Consecutive Rows in a Feature Class in Python</title>
      <link>https://community.esri.com/t5/python-questions/selecting-consecutive-rows-in-a-feature-class-in/m-p/194598#M14938</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; You can then use a search cursor on that table to get a complete list of values and easily select the next lowest value by sorting your list.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Just a thought -- you don't need to use the Sort tool; just specify the sorting when you request the search cursor.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Jan 2012 17:09:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/selecting-consecutive-rows-in-a-feature-class-in/m-p/194598#M14938</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2012-01-25T17:09:15Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting Consecutive Rows in a Feature Class in Python</title>
      <link>https://community.esri.com/t5/python-questions/selecting-consecutive-rows-in-a-feature-class-in/m-p/194599#M14939</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hey Andrew,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your response. I think I did a poor job of explaining what I am trying to do. I have a feature class that is sorted by a date/time field. The earliest date is first. I have then run a datediff tool to determine the difference in time (in hours) and populated a field (hours) to show the difference in hours between features. I want to select the features that have less than 6 hours between them, which I can do. This allows me to get a starting point. I then want to include in that selection the next feature below that, so the next feature in the table, which will allow me to have an end point. I am having trouble figuring out how to create query for this second group of features I would like to select because the hours field is difference between the next row and not the previous row. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Name&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date/Time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Hours&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Feature 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Jan 23/9AM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Feature 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Jan 23/12PM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Feature 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Jan 24/6AM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 18&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Feature 4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Jan 24/12PM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Feature 5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Jan 25/6PM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 30&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Feature 6&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Jan 27/6PM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 48&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So I can select feature 1, 2, and 4, but I also want to select feature 3, simply based on the fact that it's following feature 2, which I already selected. My assumption is that feature 2 and feature 3 are the starting and ending point of an event. I also want to select feature 5 (the end point), because I have feature 4 (the start point) selected. Feature 6 will not be in the selection because it is not a starting point (hour &amp;lt; 6) and does not follow a point where hour &amp;lt; 6.&amp;nbsp; I am hoping that this will allow me to create a feature class that will include the starting and ending points of certain events. I apologize. I hope this makes sense. I'm trying to learn python on the fly. Thanks again for any help you can provide.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Tommy Burk&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Jan 2012 17:21:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/selecting-consecutive-rows-in-a-feature-class-in/m-p/194599#M14939</guid>
      <dc:creator>TommyBurk</dc:creator>
      <dc:date>2012-01-25T17:21:26Z</dc:date>
    </item>
  </channel>
</rss>

