1、创建一个三维的数组

numpy多为数组和切片的索引

numpy多为数组和切片的索引2numpy多为数组和切片的索引

2、b=[0:0:0]表示去所有层,所有行所有列。我们可以用三维坐标选定任意一个房间,即楼层,行号和列号

numpy多为数组和切片的索引

numpy多为数组和切片的索引

表示去第一层,所有行所有列的房间。多个冒号可以用省略号来代替

numpy多为数组和切片的索引

numpy多为数组和切片的索引

3、选取所有楼层,第2列的房间

numpy多为数组和切片的索引numpy多为数组和切片的索引

4、第1层位于第2列的房间

numpy多为数组和切片的索引


numpy多为数组和切片的索引

5、第1层最后1列的房间,-1表示最后一列

numpy多为数组和切片的索引


numpy多为数组和切片的索引

6、反向选取第1层,倒数第1行的房间。::-1表示逆向选取间隔为1 的所有列。::1表示正向选取间隔为1 的所有列。::-2表示逆向选取间隔为2 的所有列


numpy多为数组和切片的索引

numpy多为数组和切片的索引

numpy多为数组和切片的索引numpy多为数组和切片的索引

numpy多为数组和切片的索引

7、反向选取第1层最后一列间隔为2 的所有行

numpy多为数组和切片的索引

numpy多为数组和切片的索引



相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-17
  • 2022-12-23
  • 2021-09-27
  • 2022-03-09
  • 2021-06-15
猜你喜欢
  • 2022-12-23
  • 2022-02-19
  • 2021-09-09
  • 2021-10-26
  • 2022-12-23
  • 2020-01-20
  • 2022-02-17
相关资源
相似解决方案