title: reverse flatten numpy array?
body: <p>I have an array</p>
  
  <p><code>[[0, 1, 0, 0] [0, 1, 0, 0] [1, 0, 0, 0] ..., [0, 1, 0, 0] [0, 1, 0, 0]
   [1, 0, 0, 0]]</code>
  of Shape<code>(38485,)</code>
  i want to reshape to <code>(38485,4)</code> like</p>
  
  <pre><code>[[0, 1, 0, 0] 
  [0, 1, 0, 0] 
  [1, 0, 0, 0]
  .
  .
  .
  [0, 1, 0, 0]
  [0, 1, 0, 0]
  [1, 0, 0, 0]]
  </code></pre>
  
  <p>but when i try <code>array.reshape(-1,4)</code> it throws me the error <code>ValueError: cannot reshape array of size 38485 into shape (4)</code> </p>
  
  <p>My code to get array:</p>
  
  <pre><code>dataset = pd.read_csv('train.csv')
  
  y = dataset.iloc[:, 6]
  
  fr=np.array([1,0,0,0])
  re=np.array([0,1,0,0])
  le=np.array([0,0,1,0])
  ri=np.array([0,0,0,1])
  for i in range(y.shape[0]):
      if y[i]=="Front":
          y[i]=fr
      elif y[i]=="Rear":
          y[i]=re
      elif y[i]=="Left":
          y[i]=le
      elif y[i]=="Right":
          y[i]=ri
  
  array=y.values
  </code></pre>
  
  <p>Is there any way I can accomplish this?</p>
  
  <p><strong>I Fixed this by</strong></p>
  
  <p><code>array = np.array([[n for n in row] for row in array])</code></p>
  
  <p>Thanks to <a href="https://stackoverflow.com/users/674039/wim">wim</a></p>