title: ValueError: ordinal must be >= 1
body: <p>This Code, Takes 2 co-ordinates for a straight line from google finance and places 3rd point on the same line at some distance.    </p>
  
  <pre><code> import datetime as dt
   from datetime import timedelta as td
   import matplotlib.pyplot as plt
   from matplotlib import style
   import pandas as pd
   import pandas_datareader.data as web
   import numpy as np
  
   start = dt.datetime(2017, 7, 1)
   end = dt.datetime(2017, 3, 1)
  
   # retrieving data from google
   df = web.DataReader('TSLA', 'google', start, )
  
   Dates = df.index
   Highs = df['High'] # Getting only the values from the 'High' Column.
  
   Highest_high = np.amax(Highs)  # returns the Highest value
        for i, h in enumerate(Highs):
             if h == Highest_high :
                Highests_index = i
   #Highests_index = Highs.argmax()  # returns the index of Highest value
  
   Highest_high_2 = sorted(Highs)[-2]
   for i, j in enumerate(Highs):
        if j == Highest_high_2 :
           Highests_index_2 = i
  
   #================Problem Maybe starting from here========================
  
   x = [Highests_index, Highests_index_2]
   y = [Highest_high, Highest_high_2]
   coefficients = np.polyfit(x, y, 1)
  
   polynomial = np.poly1d(coefficients)
   # the np.linspace lets you set number of data points, line length.
   x_axis = np.linspace(3,Highests_index_2 + 1, 3)
   y_axis = polynomial(x_axis)
  
   plt.plot(x_axis, y_axis)
   plt.plot(x[0], y[0], 'go')
   plt.plot(x[1], y[1], 'go')
   plt.plot(Dates, Highs)
   plt.grid('on')
   plt.show()
  </code></pre>
  
  <p>the following error occurs with lots of Traceback</p>
  
  <blockquote>
    <p>dt = datetime.datetime.fromordinal(ix).replace(tzinfo=UTC)<br>
    ValueError: ordinal must be >= 1</p>
  </blockquote>
  
  <p>The above code works well when I just plot the numeric values without using datetime and pandas. I think the issue might be in datetime or in matplotlib.</p>
  
  <p>I know this question might look duplicate, but I cannot relate my problem to any other solutions here.</p>