title: Python, connect two data points at the beginning and end of a series
body: <p>I would really like to know how I can plot the mean of two points on a chart with Python. I have stock data with 200 data points, and I want to take the mean of the first 20 points and the mean of the last 20 points, and then plot a line connecting those two points. I do not want any of the data points between those two to be taken into account. </p>
  
  <p>my entire program is as such </p>
  
  <pre><code>stock = web.get_data_yahoo('clh.ax', '10/01/2017', interval='d')
  
  stock['ema']=stock['Adj Close'].ewm(span=100,min_periods=0).mean()
  
  stock['std']=stock['Adj Close'].rolling(window = 20,min_periods=0).std()
  
  # bollinger bands
  stock['close 20 day mean'] = stock['Close'].rolling(20,min_periods=0).mean()
  # upper band
  stock['upper'] = stock['close 20 day mean'] + 2 * (stock['Close'].rolling(20, min_periods=0).std())
  # lower band
  stock['lower'] = stock['close 20 day mean'] - 2 * (stock['Close'].rolling(20, min_periods=0).std())
  # end bollinger bands
  
  fig,axes = plt.subplots(nrows=3, ncols =1, figsize=(10,6))
  
  axes[0].plot(stock['Close'], color='red')
  axes[0].plot(stock['ema'], color='blue')
  axes[0].plot(stock['close 20 day mean'], color='black')
  axes[0].plot(stock['upper'], color='black')
  axes[0].plot(stock['lower'], color='black')
  
  axes[1].plot(stock['Volume'],color='purple')
  axes[2].plot(stock['std'], color='black')
  </code></pre>