title: list values combinations with last element
body: <p>what i want is to take all the elements from peaks except last  one and make a combination with last element   i.e dont repeat all the combinations just make a combination with last element.</p>
  <p>i am using itertools so if there are 2 elements in peaks it works  but when there are 3 or more then it repeats the combinations</p>
  <pre><code>import pandas as pd 
  from datetime import datetime as dt, timedelta 
  import numpy as np
  import yfinance as yf
  import matplotlib.pyplot as plt
  from peakdetect import peakdetect
  import itertools as it
  
  df= yf.Ticker('GAIL.NS').history(period=&quot;1d&quot;,interval=&quot;2m&quot;)
  
  
  for i in range (0, len(df['Close'])):
      plt.plot(df['Close'].values[:i+1])
          
      x=df['Close'].values[:i+1]
  
      pd_peaks = peakdetect(x, lookahead = 1,delta = 0.0)    
      pd_lowerPeaks = np.array(pd_peaks[1])
      pd_higherPeaks = np.array(pd_peaks[0]) 
        
      print('peaks',pd_higherPeaks.tolist())  
  
      for combination in it.combinations(pd_higherPeaks,2):
          print('combination',combination[0],combination[1])
      
      plt.draw()
      plt.waitforbuttonpress(0)
      # plt.close()
  
  
  </code></pre>
  <pre><code>output
  # peaks [[2.0, 143.0500030517578], [6.0, 141.89999389648438]]
  # combination [  2.         143.05000305] [  6.        141.8999939] - output is ok 
  
  # peaks [[2.0, 143.0500030517578], [6.0, 141.89999389648438], [10.0, 141.39999389648438]]
  # combination [  2.         143.05000305] [  6.        141.8999939]  - no need  as it is repeated
  # combination [  2.         143.05000305] [ 10.        141.3999939] - want this 
  # combination [  6.        141.8999939] [ 10.        141.3999939]  - want this 
  
  # peaks [[2.0, 143.0500030517578], [6.0, 141.89999389648438], [10.0, 141.39999389648438], [15.0, 142.25]]
  # combination [  2.         143.05000305] [  6.        141.8999939] - no need  as it is repeated
  # combination [  2.         143.05000305] [ 10.        141.3999939] - no need  as it is repeated 
  # combination [  2.         143.05000305] [ 15.   142.25] - want this 
  # combination [  6.        141.8999939] [ 10.        141.3999939] - no need  as it is repeated
  # combination [  6.        141.8999939] [ 15.   142.25] - want this 
  # combination [ 10.        141.3999939] [ 15.   142.25] - want this 
  
  
  </code></pre>