Skip to main content

NumPy Iterator


In this tutorial you will learn:

  • Iterating Arrays using nditer
  • DataType Casting
  • Iterating with Step Sizing

Iterating Arrays using nditer()

nditer is an iterator object that was first introduced in NumPy 1.6. For a multi dimensional array it becomes a cumbersome task to write a For loop for each dimension, so nditer provides a flexibility to efficiently and systematically iterate a complete n-dimensiona array.

In this example I will iterate a 2D array using nditer(). Here you can observe that by using nditer() the task of iteration appears more easy, compact and straight

Add new comment