Merge pandas dataframe with unequal length
<p>I have two Pandas dataframes that I would like to merge into one. They have unequal length, but contain some of the same information.</p>
<p>Here is the first dataframe:</p>
<pre><code>BOROUGH  TYPE  TCOUNT
  MAN    SPORT   5
  MAN    CONV    3
  MAN    WAGON   2
  BRO    SPORT   2
  BRO    CONV    3
</code></pre>
<p>Where column <code>A</code> specifies a location, <code>B</code> a category and <code>C</code> a count.</p>
<p>And the second:</p>
<pre><code>BOROUGH  CAUSE  CCOUNT
  MAN   ALCOHOL   5
  MAN     SIZE    3
  BRO   ALCOHOL   2
</code></pre>
<p>Here <code>A</code> is again the same Location as in the other dataframe. But <code>D</code> is another category, and <code>E</code> is the count for <code>D</code> in that location.</p>
<p>What I want (and haven't been able to do) is to get the following:</p>
<pre><code>BOROUGH   TYPE   TCOUNT  CAUSE  CCOUNT
  MAN    SPORT     5    ALCOHOL    5
  MAN    CONV      3      SIZE     3
  MAN    WAGON     2      NaN     NaN
  BRO    SPORT     2    ALCOHOL    2
  BRO    CONV      3      NaN     NaN
</code></pre>
<p>&quot;-&quot; can be anything. Preferably a string saying &quot;Nothing&quot;. If they default to NaN values, I guess it's just a matter of replacing those with a string.</p>
<p><strong>EDIT</strong>:<br />
Output:</p>
<pre><code>&lt;class 'pandas.core.frame.DataFrame'&gt;
Int64Index: 233 entries, 0 to 232
Data columns (total 3 columns):
BOROUGH                          233 non-null object
CONTRIBUTING FACTOR VEHICLE 1    233 non-null object
RCOUNT                           233 non-null int64
dtypes: int64(1), object(2)
memory usage: 7.3+ KB
None

&lt;class 'pandas.core.frame.DataFrame'&gt;
Int64Index: 83 entries, 0 to 82
Data columns (total 3 columns):
BOROUGH                83 non-null object
VEHICLE TYPE CODE 1    83 non-null object
VCOUNT                 83 non-null int64
dtypes: int64(1), object(2)
memory usage: 2.6+ KB
None
</code></pre>