title: Value error of incompatible row dimension occurred while training the model
body: <p>i was implementing a <strong>decision tree</strong> on a <a href="https://www.kaggle.com/sid321axn/amazon-alexa-reviews" rel="nofollow noreferrer">dataset</a>. Before that i wanted to transform a particular column with <strong>CountVectorizer</strong>. For this, i am using <strong>pipeline</strong> to make it simpler. </p>
  
  <p>But there is an <em>error of incompatible row dimensions</em>. </p>
  
  <h2>code</h2>
  
  <pre><code># Imported the libraries....
  from sklearn.feature_extraction.text import CountVectorizer as cv
  from sklearn.preprocessing import OneHotEncoder as ohe
  from sklearn.compose import ColumnTransformer as ct
  from sklearn.pipeline import make_pipeline as mp
  from sklearn.tree import DecisionTreeClassifier as dtc
  
  
  transformer=ct(transformers=[('review_counts',cv(),['verified_reviews']),
                               ('variation_dummies', ohe(),['variation'])
                              ],remainder='passthrough')
  
  pipe= mp(transformer,dtc(random_state=42))
  
  x= data[['rating','variation','verified_reviews']].copy()
  y= data.feedback
  
  x_train,x_test,y_train,y_test= tts(x,y,test_size=0.3,random_state=42,stratify=y)
  print(x_train.shape,y_train.shape)             # ((2205, 3), (2205,))
  
  pipe.fit(x_train,y_train)                       # Error on this line
  </code></pre>
  
  <h2>Error</h2>
  
  <pre><code>---------------------------------------------------------------------------
  ValueError                                Traceback (most recent call last)
  &lt;ipython-input-79-a981c354b190&gt; in &lt;module&gt;()
  ----&gt; 1 pipe.fit(x_train,y_train)
  
  7 frames
  /usr/local/lib/python3.6/dist-packages/scipy/sparse/construct.py in bmat(blocks, format, dtype)
      584                                                     exp=brow_lengths[i],
      585                                                     got=A.shape[0]))
  --&gt; 586                     raise ValueError(msg)
      587 
      588                 if bcol_lengths[j] == 0:
  
  ValueError: blocks[0,:] has incompatible row dimensions. Got blocks[0,1].shape[0] == 2205, expected 1.
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/6tqjj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6tqjj.png" alt="pic"></a></p>
  
  <h2>Questions</h2>
  
  <ol>
  <li>How this <strong>error of incompatible row dimension is forming</strong> ? </li>
  <li>How it can be solved?</li>
  </ol>