title: How can I concatenate Pandas DataFrames by column and index?
body: <p>I've got four Pandas DataFrames with numerical columns and indices:</p>
  
  <pre><code>A = pd.DataFrame(data={"435000": [9.792, 9.795], "435002": [9.825, 9.812]}, index=[119000, 119002])
  B = pd.DataFrame(data={"435004": [9.805, 9.783], "435006": [9.785, 9.78]}, index=[119000, 119002])
  C = pd.DataFrame(data={"435000": [9.778, 9.743], "435002": [9.75, 9.743]}, index=[119004, 119006])
  D = pd.DataFrame(data={"435004": [9.743, 9.743], "435006": [9.762, 9.738]}, index=[119004, 119006])
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/eJQd9.png" rel="noreferrer"><img src="https://i.stack.imgur.com/eJQd9.png" alt="enter image description here"></a></p>
  
  <p>I want to concatenate them into one DataFrame like this, matching on both column names and indices:</p>
  
  <p><a href="https://i.stack.imgur.com/sjEHT.png" rel="noreferrer"><img src="https://i.stack.imgur.com/sjEHT.png" alt="enter image description here"></a></p>
  
  <p>If I try to <code>pd.concat</code> the four dfs, they are stacked (either above and below, or to the side, depending on <code>axis</code>) and I end up with <code>NaN</code> values in the df:</p>
  
  <pre><code>result = pd.concat([A, B, C, D], axis=0)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/s2YQI.png" rel="noreferrer"><img src="https://i.stack.imgur.com/s2YQI.png" alt="enter image description here"></a></p>
  
  <p>How can I use <code>pd.concat</code> (or <code>merge</code>, <code>join</code> etc.) to get the right result?</p>