In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the knowledge of "how numpy.clip keeps the values in the array within a certain range". In the operation of actual cases, many people will encounter this dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Numpy.clip keeps the values in the array within a certain interval np.clip ()
Given an interval range, the values outside the interval range will be truncated to the boundary of the interval. For example, if the specified interval is [- 1 minute 1], values less than-1 will become-1, and values greater than 1 will become 1.
Array = np.array ([10, 7, 4, 3, 2, 2, 5, 9, 0, 4, 6, 0]) print (np.clip (array,2,6)) # output: [6 6 4 3 2 5 6 4 6 2]
Elements less than 2 become 2, elements greater than 6 become 6, and a line of code is far more concise and efficient than this:
Array [array6] = 6 "how numpy.clip keeps the values in the array within a certain range" ends here. Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.