title: How to compare a dataframe to a subset intersection of another dataframe in pandas in python?
body: <p>I have a the following dataframes in python:</p>
  
  <h3>dataframe 1</h3>
  
  <pre><code>             1  2  3  4  5
  dog   dog    0  0  0  0  0
        fox    0  0  0  0  0
        jumps  0  0  0  0  0
        over   0  0  0  0  0
        the    0  0  0  0  0
  fox   dog    0  0  0  0  0
        fox    0  0  0  0  0
        jumps  0  0  0  0  0
        over   0  0  0  0  0
        the    0  0  0  0  0
  jumps dog    0  0  0  0  0
        fox    0  0  0  0  0
        jumps  0  0  0  0  0
        over   0  0  0  0  0
        the    0  0  0  0  0
  over  dog    0  0  0  0  0
        fox    0  0  0  0  0
        jumps  0  0  0  0  0
        over   0  0  0  0  0
        the    0  0  0  0  0
  the   dog    0  0  0  0  0
        fox    0  0  0  0  0
        jumps  0  0  0  0  0
        over   0  0  0  0  0
        the    0  0  0  0  0
  </code></pre>
  
  <h3>dataframe 2</h3>
  
  <pre><code>             1  2  4  5
  dog   dog    0  0  0  0
        fox    0  0  0  0
        jumps  0  0  0  0
        the    0  0  0  0
        horse  0  0  0  0
  fox   dog    0  0  0  0
        fox    0  0  0  0
        over   0  0  0  0
        the    0  0  0  0
        cat    0  0  0  0
  </code></pre>
  
  <p>You can see that dataframe2 contains multiindexes of dataframe1 but it also contains additional multiindexes like horse and cat. Dataframe 2 also doesn't contain all the columns of dataframe 1 as you can see it misses column 3.</p>
  
  <p>I want to compare these two dataframes in such a way that the function returns True if the values of any common first->second (multi) indices between the two dataframes also match each other, otherwise False.</p>
  
  <p>I could iterate over by looking over each value manually but that would increase the function's time complexity. Does any know if pandas provides a builtin way of doing this or do I need to construct a function myself. If so, can you point me in the right direction? Any suggestions are highly appreciated. Thank you.</p>