title: How to deal with different time series of variable length with pandas?
body: <p>I have data matrix in which each row considered as time series but of different length. This is how it looks like:</p>
  <p><img src="https://i.stack.imgur.com/d8Img.png" alt="This is how it looks like" /></p>
  <p>In text:</p>
  <blockquote>
  <p>0 1   2   3   4   5   6   7   8   9</p>
  <p>0 12  32  45  67  89  54  23.0    56.0    78.0    98.0</p>
  <p>1 34  76  34  89  34  3   NaN NaN NaN NaN</p>
  <p>2 76  34  54  12  43  78  56.0    NaN NaN NaN</p>
  <p>3 76  56  45  23  43  45  67.0    76.0    67.0    8.0</p>
  <p>4 87  9   9   0   89  90  6.0 89.0    NaN NaN</p>
  <p>5 23  90  90  32  23  34  56.0    9.0 56.0    87.0</p>
  <p>6 23  56  34  3   5   8   7.0 6.0 98.0    NaN</p>
  <p>7 32  23  34  6   65  78  67.0    87.0    89.0    87.0</p>
  <p>8 12  23  34  32  43  67  45.0    NaN NaN NaN</p>
  <p>9 343 76  56  7   8   9   4.0 5.0 8.0 68.0</p>
  </blockquote>
  <p>I had tried reading data using pandas with code:</p>
  <pre><code>timeseries=pd.read_excel('timeseries.xlsx',header=None)
  ######   timeseries   ##############
  print(timeseries)
  </code></pre>
  <p>Then I want to pass each row of datamatrix to timeseries analysis model which will generate a single value for each timeseries and after passing all timeseries I'll get a feature vector.</p>
  <p>I had tried implementing using code below:</p>
  <pre><code>features=[]
  for i,j in timeseries.iterrows():
      row=timeseries.iloc[i]
      model=AR(row.values)
      model_fit=model.fit()
      yhat=model_fit.predict(len(row),len(row))
      features.append(yhat)
  fvector=pd.DataFrame(features)
  print(fvector)
  </code></pre>
  <p>but I got this as error</p>
  <blockquote>
  <p>MissingDataError: exog contains inf or nans</p>
  </blockquote>
  <p>To the best of my knowledge it occurs as the analysis method restricts NaN value and throws this error but according to my situation each time series needs to be considered as independent input to the analysis method and should read till the last real value of each row.</p>
  <p>How can I solve this issue?</p>