docstr: Align two time series so that len(self) == len(other) and self.timstamps == other.timestamps.
  
  :return: :tuple:(`TimeSeries` object(the aligned self), `TimeSeries` object(the aligned other))
docstr_tok: ["Align","two","time","series","so","that","len","(","self",")","==","len","(","other",")","and","self.timstamps","==","other.timestamps",".",":","return",":",":","tuple",":","(","`","TimeSeries","`","object","(","the","aligned","self",")",",","`","TimeSeries","`","object","(","the","aligned","other",")",")"]
code: def align(self, other):
      """
      Align two time series so that len(self) == len(other) and self.timstamps == other.timestamps.
  
      :return: :tuple:(`TimeSeries` object(the aligned self), `TimeSeries` object(the aligned other))
      """
      if isinstance(other, TimeSeries):
          aligned, other_aligned = {}, {}
          i, other_i = self.iteritems_silent(), other.iteritems_silent()
          item, other_item = next(i), next(other_i)
  
          while item and other_item:
              # Unpack timestamps and values.
              timestamp, value = item
              other_timestamp, other_value = other_item
              if timestamp == other_timestamp:
                  aligned[timestamp] = value
                  other_aligned[other_timestamp] = other_value
                  item = next(i)
                  other_item = next(other_i)
              elif timestamp < other_timestamp:
                  aligned[timestamp] = value
                  other_aligned[timestamp] = other_value
                  item = next(i)
              else:
                  aligned[other_timestamp] = value
                  other_aligned[other_timestamp] = other_value
                  other_item = next(other_i)
          # Align remaining items.
          while item:
              timestamp, value = item
              aligned[timestamp] = value
              other_aligned[timestamp] = other.values[-1]
              item = next(i)
          while other_item:
              other_timestamp, other_value = other_item
              aligned[other_timestamp] = self.values[-1]
              other_aligned[other_timestamp] = other_value
              other_item = next(other_i)
          return TimeSeries(aligned), TimeSeries(other_aligned)
  
imports: import numpy
label_desc: Use image node_id 28 for calling the TimeSeries obj's underlying member method code with example usage: obj.align(other) and returns: TimeSeries,  TimeSeries