title: how to reduce running time in for loop in two list iteration?
body: <p>In my dataframe there are more than 50k rows, my code is getting more than 30 minutes to run,</p>
  <p>dataframe type</p>
  <pre><code>df = pd.DataFrame({'fname':['richard','patricia','william','michael'],
  'lname':['dietzen','economides','macdonald','boothby'],
  'contact':['+187086706','not available','+124471426','+181773663'],
  'bus_contact':['not available','+124789540','+156984476','not available'],
  'email':['not available','patricia.econo@gmail.com','dpjpropmanagement@gmail.com','othby@osmifw.com'],
  'bus_mail':['rdieen@hotmail.com','wmacdon@mcrtrust.com','not available','michel.booby@yahoo.com'],
  'website':['www.chicainexts.com','www.dpjrymanagement.com','www.millplaces.com','www.ofw.co']})
  </code></pre>
  <p>The following list is index of the data frame in tuple format</p>
  <pre><code>multi_idx_val=[(0,1),(0,2),(0,3),(1,2),(1,3),(2,3)]
  </code></pre>
  <p>the expected output is a list that contain the len of intersection of index tuples value, following code is my one but it's taking too much time to run</p>
  <pre><code>elements_in_all_list = []
  for tup in multi_idx_val:
  
     idx_list_1 = []
     idx_list_2 = []
     list_df1=df[df.index==tup[0]].values.tolist()
     for idx_1,item_1 in enumerate(sum(list_df1,[])):
        if item_1 != 'not available':
            idx_list_1.append(idx_1)
  
     list_df2=df[df.index==tup[1]].values.tolist()
     for idx_1,item_1 in enumerate(sum(list_df2,[])):
        if item_1 != 'not available':
            idx_list_2.append(idx_1)
     elements_in_all = list(set(idx_list_1).intersection(idx_list_2))
     elements_in_all_list.append(elements_in_all)
  
  count_element = []
  for element in elements_in_all_list:
     count_element.append(len(element))
  print(count_element)
  </code></pre>
  <p>can anyone help using numpy vectorize or other solution for reduce the running time of the code.</p>