How to operate Python to traverse numpy array

php中世界最好的语言
Release: 2018-04-09 15:45:13
Original
6209 people have browsed it

This time I will bring you how to operatePythonTraverse numpyarray, what are the notes when operating Python to traverse numpy array, the following is a practical case, Let’s take a look.

When using python for image processing, sometimes it is necessary to traverse the numpy array. The following is the method of traversing the array:

[rows, cols] = num.shape 
for i in range(rows - 1): 
 for j in range(cols-1): 
  print(num[j, i])
Copy after login

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!

Recommended reading:

How to obtain the local peak value of a two-dimensional array in python

How to use OpenCV with the Python interface

The above is the detailed content of How to operate Python to traverse numpy array. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!