title: How to generate a new data frame by matching common values in this case?
body: <p>I have two data frames like this:</p>
  
  <pre><code>data_2019_dict = {'state': ['Ohio', 'Texas', 'Pennsylvania', 'Nevada', 'New York', 'Nevada', 'Ohio', 'Virginia', 'Louisiana', 'Florida', 'Nevada'],
   'industry': ['Agriculture', 'Agriculture', 'Agriculture', 'Agriculture', 'Medicine', 'Medicine', 'Medicine', 'Medicine', 'Manufacture', 'Manufacture', 'Manufacture'],
   'value': [3.6, 3.2, 2.9, 2.4, 3.1, 1.5, 1.4, 0.9, 4.4, 2.0, 1.9]}
  
  data_2020_dict = {'state': ['Kansas', 'Texas', 'California', 'Idaho', 'Nevada', 'Ohio', 'Virginia', 'Louisiana', 'Texas', 'Nevada'],
   'industry': ['Agriculture', 'Agriculture', 'Agriculture', 'Medicine', 'Medicine', 'Finance', 'Finance', 'Manufacture', 'Manufacture', 'Manufacture'],
  'value': [2.3, 1.8, 1.6, 7.2, 5.9, 4.1, 0.2, 5.1, 2.3, 2.2]}
  
  data_2019 = pd.DataFrame(data_2019_dict)
  data_2020 = pd.DataFrame(data_2020_dict)
  
  </code></pre>
  
  <p>Each data frame shows that in a year, which states perform well in those industries. What I want to generate, but get stuck, is: For each state, what industries are performed well in both years? The resulting data frame will look like this:</p>
  
  <p><a href="https://i.stack.imgur.com/ED2L4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ED2L4.png" alt="enter image description here"></a></p>
  
  <pre><code># Manually generated for illustration 
  data_both_dict = {'state': ['Ohio', 'Texas', 'Pennsylvania', 'Nevada', 'Nevada', 'New York', 'Virginia', 'Louisiana', 'Florida', 'Kansas', 'California', 'Idaho'],
               'common_industry': ['', 'Agriculture', '', 'Medicine', 'Manufacture', '', '', 'Manufacture', '', '', '', ''],
               'common_industry_count': [0, 1, 0, 2, 2, 0, 0, 1, 0, 0, 0, 0]
  }
  data_both = pd.DataFrame(data_both_dict)
  </code></pre>