Updated On : Jul-18,2020 Time Investment : ~10 mins

Learning Numpy - Simple Tutorial For Beginners - NumPy - Array Manipulation Part 12

Several routines are available in NumPy package for manipulation of elements in ndarray object. They can be classified into the following types −

Changing Shape

Parameter Description
reshape Gives a new shape to an array without changing its data
flat A 1-D iterator over the array
flatten Returns a copy of the array collapsed into one dimension
ravel Returns a contiguous flattened array

Transpose Operations

Parameter Description
transpose Permutes the dimensions of an array
ndarray.T Same as self.transpose()
rollaxis Rolls the specified axis backwards
swapaxes Interchanges the two axes of an array

Changing Dimensions

Parameter Description
broadcast Produces an object that mimics broadcasting
broadcast_to Broadcasts an array to a new shape
expand_dims Expands the shape of an array
squeeze Removes single-dimensional entries from the shape of an array

Joining Arrays

Parameter Description
concatenate Joins a sequence of arrays along an existing axis
stack Joins a sequence of arrays along a new axis
hstack Stacks arrays in sequence horizontally (column wise)
vstack Stacks arrays in sequence vertically (row wise)

Splitting Arrays

Parameter Description
concatenate Joins a sequence of arrays along an existing axis
stack Joins a sequence of arrays along a new axis
hstack Stacks arrays in sequence horizontally (column wise)
vstack Stacks arrays in sequence vertically (row wise)

Adding / Removing Elements

Parameter Description
resize Returns a new array with the specified shape
append Appends the values to the end of an array
insert Inserts the values along the given axis before the given indices
delete Returns a new array with sub-arrays along an axis deleted
unique Finds the unique elements of an array
Dolly Solanki  Dolly Solanki

YouTube Subscribe Comfortable Learning through Video Tutorials?

If you are more comfortable learning through video tutorials then we would recommend that you subscribe to our YouTube channel.

Need Help Stuck Somewhere? Need Help with Coding? Have Doubts About the Topic/Code?

When going through coding examples, it's quite common to have doubts and errors.

If you have doubts about some code examples or are stuck somewhere when trying our code, send us an email at coderzcolumn07@gmail.com. We'll help you or point you in the direction where you can find a solution to your problem.

You can even send us a mail if you are trying something new and need guidance regarding coding. We'll try to respond as soon as possible.

Share Views Want to Share Your Views? Have Any Suggestions?

If you want to

  • provide some suggestions on topic
  • share your views
  • include some details in tutorial
  • suggest some new topics on which we should create tutorials/blogs
Please feel free to contact us at coderzcolumn07@gmail.com. We appreciate and value your feedbacks. You can also support us with a small contribution by clicking DONATE.


Subscribe to Our YouTube Channel

YouTube SubScribe

Newsletter Subscription