DEV Community

TechPlygrnd
TechPlygrnd

Posted on • Edited on

1

NumPy Tutorial #8: Array Iterating

What is iterating means? basically iterating is going through elements of array one by one. How can we iterating an array? let me explain to you how to do it.


Iterating

For perform iterating in NumPy array, we could just do that by using python basic iteration for list.

import numpy as np

arr = np.array([1, 2, 3])

# Python basic list iteration
for x in arr:
  print(x)
Enter fullscreen mode Exit fullscreen mode

If you run the code, you will get the following output

1
2
3
Enter fullscreen mode Exit fullscreen mode

There you go, that is how you can perform iteration in NumPy array. Thank you for reading and see you next time!

Top comments (0)

Billboard image

Try REST API Generation for MS SQL Server.

DevOps for Private APIs. With DreamFactory API Generation, you get:

  • Auto-generated live APIs mapped from database schema
  • Interactive Swagger API documentation
  • Scripting engine to customize your API
  • Built-in role-based access control

Learn more

👋 Kindness is contagious

Explore this insightful post in the vibrant DEV Community. Developers from all walks of life are invited to contribute and elevate our shared know-how.

A simple "thank you" could lift spirits—leave your kudos in the comments!

On DEV, passing on wisdom paves our way and unites us. Enjoyed this piece? A brief note of thanks to the writer goes a long way.

Okay