title: python: I want to realize change point detection using changefinder
body: <p><strong>Assumptions</strong></p>
  
  <p>I am a beginner programmer.</p>
  
  <p>I want to realize change point detection in Python3.
  The library used is "ChangeFinder".
  I want to get the first-order difference (y_diff) from the temperature data, and output a graph with ChangeFinder applied to it.
  Thank you for your answers and advice.</p>
  
  <p><strong>The problem / error message</strong></p>
  
  <pre><code>
  ValueError: view limit minimum -36868.78052083334 is less than 1 and is an invalid Matplotlib date value. This often happens if you pass a non-datetime value to an axis that has datetime units
  
  </code></pre>
  
  <p><strong>Applicable source code</strong></p>
  
  <pre><code>
  import pylab
  from statsmodels.tsa.ar_model import AR
  import numpy as np
  import pandas as pd
  import matplotlib.pyplot as plt
  from statsmodels.tsa import stattools
  from statsmodels.tsa import ar_model
  from statsmodels.graphics import tsaplots
  import changefinder as cf
  
  df_templeture = pd.read_csv('templeture_data_.csv')
  y = pd.Series(df_templeture.templeture.values, index=pd.date_range(start='2019-11-11  22:00:00', periods=len(df_templeture),freq='min'))
  
  y_diff = y.diff()
  
  cf = changefinder.ChangeFinder(r=0.01, order=1, smooth=7)
  
  result = np.empty(len(y_diff))
  for i, d in enumerate(y_diff):
      result[i] = cf.update(d)
  fig = plt.figure()
  ax = fig.add_subplot(111)
  ax.plot(result, label="score")
  ax2 = ax.twinx()
  ax2.plot(y_diff, alpha=0.3, label="observation")
  
  </code></pre>
  
  <p><strong>-----Postscript-----</strong></p>
  
  <p>Graph was displayed. But, score data isn't existed.</p>
  
  <p><strong>Applicable source code</strong></p>
  
  <pre><code>y_diff = y.diff()
  print(y_diff)
  data = y_diff.values.tolist()
  print(data)
  print(len(data))
  cf = changefinder.ChangeFinder(r=0.01, order=12, smooth=7)
  
  #y_diff = y.diff().values.tolist()
  result = np.empty(len(data))
  for i, d in enumerate(data):
      # スコア
      result[i] = cf.update(d)
  
  fig = plt.figure()
  ax = fig.add_subplot(111)
  ax.plot(ret, label="score")
  ax2 = ax.twinx()
  ax2.plot(data, alpha=0.3, label="observation")
  </code></pre>
  
  <p><strong>Result</strong></p>
  
  <pre><code>2019-11-11 22:01:00    0.00
  2019-11-11 22:02:00    0.00
  2019-11-11 22:03:00    0.00
  2019-11-11 22:04:00   -0.49
                         ... 
  2019-11-12 21:56:00    0.00
  2019-11-12 21:57:00    0.00
  2019-11-12 21:58:00    0.00
  2019-11-12 21:59:00    0.00
  2019-11-12 22:00:00     NaN
  Freq: T, Length: 1441, dtype: float64
  [nan, 0.0, 0.0, 0.0, -0.48999999999999844, 0.0, 0.0, 0.0, 0.0, 0.48999999999999844, -0.48999999999999844, 
  ・・・
   -0.48999999999999844, 0.0, 0.0, 0.0, 0.0, nan]
  1441(←data length)
  </code></pre>
  
  <p><em>data length is 1441. But, plot of data display only a few data.</em></p>
  
  <p><strong>The problem / error message</strong></p>
  
  <pre><code>C:\Users\~~~\__init__.py:24: RuntimeWarning: divide by zero encountered in double_scalars
    lam /= e[k]
  C:\Users\~~~\__init__.py:34: RuntimeWarning: invalid value encountered in multiply
    a = np.array(U) + lam * np.array(V)
  C:\Users\~~~\__init__.py:35: RuntimeWarning: invalid value encountered in double_scalars
    e[k + 1] = e[k] * (1.0 - lam * lam)
  </code></pre>
  
  <p>I show graph below.</p>
  
  <p><a href="https://i.stack.imgur.com/p3VQf.png" rel="nofollow noreferrer">Graph of "data" and "score"</a></p>