title: Join one dataset and the result of OneHotEncoder in Pandas
body: <p>Let's consider the dataset of House prices from <a href="https://github.com/ageron/handson-ml/blob/master/02_end_to_end_machine_learning_project.ipynb" rel="nofollow noreferrer">this example</a>.</p>
  
  <p>I have the entire dataset stored in the <code>housing</code> variable:</p>
  
  <pre><code>housing.shape
  </code></pre>
  
  <blockquote>
    <p>(20640, 10) </p>
  </blockquote>
  
  <p>I also have done a OneHotEncoder encoding of one dimensions and get <code>housing_cat_1hot</code>, so</p>
  
  <pre><code>housing_cat_1hot.toarray().shape
  </code></pre>
  
  <blockquote>
    <p>(20640, 5)</p>
  </blockquote>
  
  <p><strong>My target is to join the two variables and store everything in just one dataset.</strong></p>
  
  <p>I have tried the <a href="https://pandas.pydata.org/pandas-docs/stable/merging.html#joining-on-index" rel="nofollow noreferrer">Join with index tutorial</a> but the problem is that the second matrix haven't any index.
  How can I do a JOIN between <code>housing</code> and <code>housing_cat_1hot</code>?</p>
  
  <pre><code>&gt;&gt;&gt; left=housing
  &gt;&gt;&gt; right=housing_cat_1hot.toarray()
  &gt;&gt;&gt; result = left.join(right)
  </code></pre>
  
  <blockquote>
    <p>Traceback (most recent call last):   File "", line 1, in
    
        result = left.join(right)   File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/pandas/core/frame.py",
    line 5293, in join
        rsuffix=rsuffix, sort=sort)   File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/pandas/core/frame.py",
    line 5323, in _join_compat
        can_concat = all(df.index.is_unique for df in frames)   File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/pandas/core/frame.py",
    line 5323, in 
        can_concat = all(df.index.is_unique for df in frames) AttributeError: 'numpy.ndarray' object has no attribute 'index'</p>
  </blockquote>