title: Iterate through pandas groups of coords and calculate distances
body: <p>I have a csv dataset that looks like this:</p>
  
  <pre><code>    created_date,latitude,longitude
  "2018-10-02 16:52:54",20.56314546,-100.40871983
  "2018-10-07 18:06:37",20.56899227,-100.40879701
  "2018-10-08 11:55:31",20.57479211,-100.39687493
  "2018-10-08 11:55:31",20.58076244,-100.36075875
  "2018-10-08 11:55:31",20.60529101,-100.40951731
  "2018-10-08 11:55:31",20.60783806,-100.37852743
  "2018-10-09 18:10:00",20.61098901,-100.38008197
  "2018-10-09 18:10:00",20.61148848,-100.40851908
  "2018-10-09 18:10:00",20.61327334,-100.34415272
  "2018-10-09 18:10:00",20.61397514,-100.33583425
  </code></pre>
  
  <p>I am trying to use pandas to separate the data into groups by date and would then like to iterate through every group and calculate the distance between the lat,longs in every group using the haversine function which takes 2 coords as params. </p>
  
  <p>In order to do so i have to calculate the distance of say <code>coord1 with coord2, coord 2 with coord 3 and so on (from the group)</code> </p>
  
  <p>I want to do this in order to calculate the average distance traveled. I'd then have to add the distances together and divide it by the number of groups.</p>
  
  <p>With pandas i managed to divide my data into groups but im not sure how to iterate through these groups, while excluding the groups (say "<code>2018-10-02 16:52:54</code>" ) which doesn't have 2 coords to calculate distance from. </p>
  
  <p>My current python script looks like this: </p>
  
  <pre><code>col_names = ['date', 'latitude', 'longitude']
  data = pd.read_csv('dataset.csv', names=col_names, sep=',', skiprows=1)
  grouped = data.groupby('date')
  for index, item in grouped:
  </code></pre>
  
  <p>Any guidance is appreciated, i have a general idea of how to do it but i'm not sure if tools like zip can help me through this.</p>