Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The process of calculating the difference between maximum and minimum values by using numpy.ptp () in Python3

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly explains the "Python3 uses numpy.ptp () to calculate the maximum and minimum value difference process", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in-depth, together to study and learn "Python3 uses numpy.ptp () to calculate the maximum and minimum value difference process"!

Numpy.ptp () is a function that calculates the difference between the maximum and minimum values. The usage is as follows:

Import numpy as npa = np.array ([np.random.randint (0,20,5), np.random.randint (0,20,5)]) print ('raw data\ nSecreta) print (' calculate all data, a.ptp () print ('axis=0, calculated in row direction, that is, each column\ norientation, a.ptp (axis=0)) # calculated in row direction, that is, each column print (' axis=1, calculated in column direction) That is, every row, a.ptp (axis=1)) # is calculated according to the column direction, that is, each row

Running result:

The original data [[9 12 11 6 8] [19 50 7 14]] calculates the 19axis=0 for all data, according to the row direction, that is, each column [10 7 11 16] axis=1, according to the column direction, that is, each row [6 19] thanks you for your reading. this is the content of "Python3 uses numpy.ptp () to calculate the difference between the maximum and minimum values". After the study of this article I believe that we have a deeper understanding of the process of Python3 using numpy.ptp () to calculate the maximum and minimum difference, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report