Python numpy reshape issues
<p>I am working with machine learning and numpy and having issues with the <code>np.reshape()</code> function.  My data sizes are reading in the variable console as Dataframe(22,5), x(21,4),x_lately(1,4), y(22,). I tried reshaping them with <code>np.reshape(22,5)</code> since that is the dataframe size and it is giving me this error:</p>

<blockquote>
  <p>ValueError: total size of new array must be unchanged</p>
</blockquote>

<p>I presume I am either not understanding something or there is something wrong with my system.</p>

<p>Thank you in advance.</p>

<p>You really need to describe your data better.</p>

<p>I can imagine the pieces fitting together:</p>

<pre><code>Dataframe(22,5), x(21,4),x_lately(1,4), y(22,)
</code></pre>

<p>The dataframe has 22 rows, 5 columns.  <code>y</code> could be one column (22 items).  <code>x</code> could be most of the 4 other columns, and <code>x_lately</code> the rest of <code>x</code>.</p>

<p>You don't describe how <code>x</code>,<code>y</code>,<code>x_lately</code> are related to the dataframe, though it looks like they might be arrays extracted from it (either as copies or views).  In any case, they cannot be <code>reshaped</code> to match the size of the dataframe.  At best they are pieces of the dataframe.</p>

<p><code>reshape</code> isn't a resize or expand or pad or anything like that.  You don't even explain why want to reshape anything.</p>

python numpy machine-learning