title: how to add the following feature to a tfidf matrix?
body: <p>Hello I have a list called list_cluster, that looks as follows:</p>
  
  <pre><code>list_cluster=["hello,this","this is a test","the car is red",...]
  </code></pre>
  
  <p>I am using TfidfVectorizer to produce a model as follows:</p>
  
  <pre><code>from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer
  with open('vectorizerTFIDF.pickle', 'rb') as infile:
      tdf = pickle.load(infile)
  tfidf2 = tdf.transform(list_cluster)
  </code></pre>
  
  <p>then I would like to add new features to this matrix called tfidf2, I have a list as follows:</p>
  
  <pre><code>dates=['010000000000', '001000000000', '001000000000', '000000000001', '001000000000', '000000000010',...]
  </code></pre>
  
  <p>this list has the same lenght of list_cluster, and represents the date has 12 positions and in the place where is the 1 is the corresponding month of the year,</p>
  
  <p>for instance '010000000000' represents february,</p>
  
  <p>in order to use it as feature first I tried:</p>
  
  <pre><code>import numpy as np
  dates=np.array(listMonth)
  dates=np.transpose(dates)
  </code></pre>
  
  <p>to get a numpy array and then to transpose it in order to concatenate it with the first matrix tfidf2</p>
  
  <pre><code>print("shape tfidf2: "+str(tfidf2.shape),"shape dates: "+str(dates.shape))
  </code></pre>
  
  <p>in order to concatenate my vector and matrix I tried:</p>
  
  <pre><code>tfidf2=np.hstack((tfidf2,dates[:,None]))
  </code></pre>
  
  <p>However this is the output:</p>
  
  <pre><code>shape tfidf2: (11159, 1927) shape dates: (11159,)
  Traceback (most recent call last):
    File "Main.py", line 230, in &lt;module&gt;
      tfidf2=np.hstack((tfidf2,dates[:,None]))
    File "/usr/local/lib/python3.5/dist-packages/numpy/core/shape_base.py", line 278, in hstack
      return _nx.concatenate(arrs, 0)
  ValueError: all the input arrays must have same number of dimensions
  </code></pre>
  
  <p>the shape seems good, but I am not sure what is failing, I would like to appreciate support to concatenate this feature to my tfidf2 matrix, thanks in advance for the atention, </p>