NumPy foreach column

1 개요[ | ]

NumPy foreach column
Python
CPU
3.3s
MEM
69M
3.5s
Reload
Copy
import numpy as np
m = np.matrix([[101,102,103],
               [201,202,203],
               [301,302,303],
               [401,402,403]])
m
Copy
def myfunc(x):
  print(x)
np.apply_along_axis(myfunc, axis=0, arr=m)
[[101 201 301 401]]
[[102 202 302 402]]
[[103 203 303 403]]
Copy
np.apply_along_axis(lambda x: print(x), axis=0, arr=m)
[[101 201 301 401]]
[[102 202 302 402]]
[[103 203 303 403]]

2 같이 보기[ | ]