title: TypeError: 'dict_items' object is not subscriptable on running if statement to shortlist items
body: <p>I am using a function below to run the apriori algorithm and calculate support, confidence for all itemsets. The function uses a dictionary object to store all values of items and their corresponding support, confidence.</p>
  
  <p>After running the if statement to select items having minimum support value of 0.15 and confidence of 0.6, I am getting an error below that dict_items object is not subscriptable. </p>
  
  <pre><code>for key, value in largeSet.items()[1:]:
  
  TypeError: 'dict_items' object is not subscriptable
  
  
  
  def runApriori(data_iter, minSupport, minConfidence):
      """
      run the apriori algorithm. data_iter is a record iterator
      Return both:
       - items (tuple, support)
       - rules ((pretuple, posttuple), confidence)
      """
      itemSet, transactionList = getItemSetTransactionList(data_iter)
  
      freqSet = defaultdict(int)
      largeSet = dict()
      # Global dictionary which stores (key=n-itemSets,value=support)
      # which satisfy minSupport
  
      assocRules = dict()
      # Dictionary which stores Association Rules
  
      oneCSet = returnItemsWithMinSupport(itemSet,
                                          transactionList,
                                          minSupport,
                                          freqSet)
  
      currentLSet = oneCSet
      k = 2
      while(currentLSet != set([])):
          largeSet[k-1] = currentLSet
          currentLSet = joinSet(currentLSet, k)
          currentCSet = returnItemsWithMinSupport(currentLSet,
                                                  transactionList,
                                                  minSupport,
                                                  freqSet)
          currentLSet = currentCSet
          k = k + 1
  
      def getSupport(item):
              """local function which Returns the support of an item"""
              return float(freqSet[item])/len(transactionList)
  
      toRetItems = []
      for key, value in largeSet.items():
          toRetItems.extend([(tuple(item), getSupport(item))
                             for item in value])
  
      toRetRules = []
      for key, value in largeSet.items()[1:]:
          for item in value:
              _subsets = map(frozenset, [x for x in subsets(item)])
              for element in _subsets:
                  remain = item.difference(element)
                  if len(remain) &gt; 0:
                      confidence = getSupport(item)/getSupport(element)
                      if confidence &gt;= minConfidence:
                          toRetRules.append(((tuple(element), tuple(remain)),
                                             confidence))
      return toRetItems, toRetRules
  
  if __name__ == "__main__":
      inFile = ''
      minSupport = 0.15
      minConfidence = 0.6
  
      items, rules = runApriori(inFile, minSupport, minConfidence)
  
      printResults(items, rules) 
  </code></pre>