118
edits
Changes
Jump to navigation
Jump to search
→Numpy.reshape
<br />
=== Reformatting Arrays ===
==== '''Numpy.reshape''' ====[[File:Reshape Example.png|thumb]]
The reshape command is super useful if you have an array of good data and you just want to change the arrangement. Maybe you have a 5x5 matrix that you want to convert to a list, or maybe you have a 6x4 matrix that you want to be a 8x3 matrix. Whatever the case, the syntax to this command is straightforward:
'''Remember: The components of the new array size must multiply to equal the total number of elements in the array.'''
==== '''Numpy.transpose''' ====
If you have taken Linear Algebra before then you know the importance of the “transpose matrix”. For those of you who haven’t taken Linear Algebra, the transpose matrix is the matrix that forms when you flip the x and y components of an array. The syntax is simply np.transpose(A), where A is the original matrix. This is best seen with an example.<br />