遍历数组的列

import numpy as np

Creating a sample numpy array (in 1D)

ary = np.arange(1, 25, 1)

Converting the 1 Dimensional array to a 2D array

(to allow explicitly column and row operations)

ary = ary.reshape(5, 5)

Displaying the Matrix (use print(ary) in IDE)

print(ary)

This for loop will iterate over all columns of the array one at a time

for col in range(ary.shape[1]):
print(ary[:, col])

相关推荐

  1. 2024-01-23 04:20:02       55 阅读
  2. 和里面对象

    2024-01-23 04:20:02       58 阅读
  3. uniapp对象常见方法

    2024-01-23 04:20:02       29 阅读
  4. Linux Shell,或文件几种不同写法

    2024-01-23 04:20:02       33 阅读
  5. Flutter循环获取索引值

    2024-01-23 04:20:02       68 阅读
  6. vue v-for 同时两个

    2024-01-23 04:20:02       38 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-01-23 04:20:02       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-01-23 04:20:02       100 阅读
  3. 在Django里面运行非项目文件

    2024-01-23 04:20:02       82 阅读
  4. Python语言-面向对象

    2024-01-23 04:20:02       91 阅读

热门阅读

  1. etcd安装

    2024-01-23 04:20:02       52 阅读
  2. Vue3setup()的非语法糖和语法糖的用法

    2024-01-23 04:20:02       49 阅读
  3. Go语言实现跳动的爱心(附带源码)

    2024-01-23 04:20:02       58 阅读
  4. 面试 Vue 框架八股文十问十答第七期

    2024-01-23 04:20:02       56 阅读
  5. 如何调整服务器系统时间

    2024-01-23 04:20:02       53 阅读
  6. spring boot 常用的 Cron 表达式

    2024-01-23 04:20:02       56 阅读
  7. 决斗(线段树)

    2024-01-23 04:20:02       52 阅读
  8. Quarkus 2.8.0引入了细粒度的Transaction API

    2024-01-23 04:20:02       58 阅读
  9. MySQL索引优化:深入理解索引合并

    2024-01-23 04:20:02       53 阅读
  10. Android扫码方案

    2024-01-23 04:20:02       53 阅读