code: def pyephem_earthsun_distance(time):
      
  
      import ephem
  
      sun = ephem.Sun()
      earthsun = []
      for thetime in time:
          sun.compute(ephem.Date(thetime))
          earthsun.append(sun.earth_distance)
  
      return pd.Series(earthsun, index=time)
docs: Calculates the distance from the earth to the sun using pyephem.
  
      Parameters
      ----------
      time : pd.DatetimeIndex
  
      Returns
      -------
      pd.Series. Earth-sun distance in AU.