title: How to interpolate latitude/longitude and heading in Pandas
body: <p><strong>Description:</strong> I have a Pandas dataframe formed by three columns: latitude [-90;90], longitude [-180;180] and direction [0;360]. All columns are in degrees.
  The index is instead formed by date + time like so:</p>
  
  <pre><code>df = pd.DataFrame({'lat':[87,90,85,10,-40,-85,-89,-40],
                     'lon':[-150,-178,176,100,10,1,-20,-100],
                     'dir':[180,200,356,4,20,1,351,20]},
                     index = pd.to_datetime(['2019-06-17 08:29:07','2019-06-17 08:29:11', '2019-06-17 08:29:16', '2019-06-17 08:29:25', '2019-06-17 08:29:33', '2019-06-17 08:29:40', '2019-06-17 08:29:48', '2019-06-17 08:29:57']))
  </code></pre>
  
  <p>This is what it looks like:</p>
  
  <pre><code>                     lat  lon  dir
  2019-06-17 08:29:07   87 -150  180
  2019-06-17 08:29:11   90 -178  200
  2019-06-17 08:29:16   85  176  356
  2019-06-17 08:29:25   10  100    4
  2019-06-17 08:29:33  -40   10   20
  2019-06-17 08:29:40  -85    1    1
  2019-06-17 08:29:48  -89  -20  351
  2019-06-17 08:29:57  -40 -100   20
  </code></pre>
  
  <p><strong>GOAL:</strong> My goal is to add the missing datetimes between the indexes and perform an interpolation (ex linear) between the missing coordinates and angles. I was able to add the missing dates like so:</p>
  
  <pre><code>idx = pd.to_datetime(pd.date_range(df.index[0], df.index[-1], freq='s').strftime('%Y-%m-%d %H:%M:%S'))
  df  = df.reindex(idx, fill_value='NaN')
  
                       lat   lon  dir
  2019-06-17 08:29:07   87  -150  180
  2019-06-17 08:29:08  NaN   NaN  NaN
  2019-06-17 08:29:09  NaN   NaN  NaN
  2019-06-17 08:29:10  NaN   NaN  NaN
  2019-06-17 08:29:11   90  -178  200
  2019-06-17 08:29:12  NaN   NaN  NaN
  2019-06-17 08:29:13  NaN   NaN  NaN
  ...................  ...   ...  ...
  2019-06-17 08:29:55  NaN   NaN  NaN
  2019-06-17 08:29:56  NaN   NaN  NaN
  2019-06-17 08:29:57  -40  -100   20
  </code></pre>
  
  <p>In order to achieve my goal I tried to use the pandas function <code>pandas.Series.interpolate</code>without success because it does not take into account the angle "jumps" between -180;180 for the longitude and the "jump" between 360 and 0 for the direction. </p>
  
  <p><strong>QUESTION:</strong> Could you please provide a smart and elengant way to achieve such interpolation so that it takes into account those jumps between the limits of their range?</p>
  
  <p><strong>Note:</strong> here there is an example just to be more clear (interpolation between -176 and 176): -176,-177,-178,-179,-180/180,179,178,177,176?</p>