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

What are the functions of python array segmentation

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

Share

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

This article mainly introduces what are the functions of python array segmentation, which are introduced in great detail and have certain reference value. Friends who are interested must finish reading them.

1. Hsplit, horizontal segmentation.

Split along its horizontal axis by specifying the number of array that returns the same shape, or the column after the split should have occurred.

2. Vsplit, split along the vertical axis.

3. Split/array_split, custom segmentation, axis=1 horizontal segmentation, axis=0 vertical segmentation.

Example

# 4. Segmentation-horizontal Segmentation h6 = np.random.randint (0Jing 100st size = (6je 4)) h6'''array ([[13,7,29,65], [57,50,79,12], [9,16,82,86], [97,62,43,92], [66,21,78,34], [95,33,51] 63]])''np.hsplit (h6Jing 2) # divide h6 horizontally into two arrays The column to be split must be a multiple of the specified partition [array ([[13,7], [57,50], [9,16], [97,62], [66,21], [95,33]]), array ([[29,65], [79,12], [82,86], [43,92], [78,34]) [51, 63])]]''np.hsplit (h6, [1d3]) # split h6 horizontally from subscript 1 and 3 [array ([[13], [57], [9], [97], [66], [95]]), array ([[7,29], [50,79], [16,82], [62]) 43], [21, 78], [33, 51]), array ([[65], [12], [86], [92], [34], [63])] [array ([[13, 7, 29, 65], [57, 50, 79, 12]), array ([9]) 16, 82, 86], [97, 62, 43, 92]), array ([[66, 21, 78, 34], [95, 33, 51, 63])]''np.vsplit (h6, [1jue 2])' [array ([13, 7, 29, 65]), array ([57, 50, 79, 12]), array ([9, 16, 82, 86], [97, 62, 43, 92]) [66, 21, 78, 34], [95, 33, 51, 63])]]''# 6 Segmentation-Custom Segmentation np.split (h6Magne2) # horizontal Segmentation Split''by column [array ([[13, 7], [57, 50], [9, 16], [97, 62], [66, 21], [95, 33]), array ([[29, 65], [79, 12], [82, 86], [43, 92], [78, 34], [51]) 63]])]''np.split (h6p3)) # Vertical split Segmentation by line''[array ([[13, 7, 29, 65], [57, 50, 79, 12]]), array ([[9, 16, 82, 86], [97, 62, 43, 92]]), array ([[66, 21, 78, 34], [95, 33, 51, 63]])] all the contents of the article "what are the functions of python array segmentation" Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

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