title: Find frequency of pair of numbers in 2D array in python
body: <p>I want to find frequency of pairs in a 2D array.
  Sample inputs is as follows:</p>
  
  <pre><code>list_of_items = [[12,14,18],[12,19,54,89,105],[ 14, 19],[54, 88 ,105,178]]
  </code></pre>
  
  <p>Expected Output is as following:</p>
  
  <pre><code>(12,14):1
  (12,18):1
  (12,19):1
  (12,54):1
  (12,88):0
  .
  .
  .
  (54,105):2
  .
  .
  </code></pre>
  
  <p>I have tried following code but I think it is not optimal solution:</p>
  
  <pre><code>number_set = [ 12, 14, 18,19,54,88,89 , 105, 178]
  
  def get_frequency_of_pairs(list_of_items, number_set):
      x=1
      combination_list = []
      result = {}
      for i in number_set:
         for j in range(x,len(number_set)):
             combination_list = combination_list +[(i,number_set[j])]
         x = x+1
      for t in combination_list:
          result[t]=0
      for t in combination_list:
         for items in list_of_items:
             if( set(t).issubset(items) ):
                result[t]=result[t]+1
      return result
  </code></pre>