Contenu connexe Similaire à NumPyの歴史とPythonの並行処理【PyData.tokyo One-day Conference 2018】 Similaire à NumPyの歴史とPythonの並行処理【PyData.tokyo One-day Conference 2018】 (20) Plus de Atsuo Ishimoto (14) NumPyの歴史とPythonの並行処理【PyData.tokyo One-day Conference 2018】5. "Python has arguably become the de facto
standard for exploratory, interactive, and
computation-driven scientific research”
!5
12. >>> y = (x >= 0.5)
>>> y
array([ True, False, False, True, False])
>>> z[y]
array([0.23273493, 0.99925692, 0.85635559])
!12
13. >>> A =[1, 2, 3]
>>> A[1]
2
>>> A[np.int64(1)]
2
!13
21. from concurrent.futures import *
def fib(n):
if n < 2:
return n
return fib(n-2) + fib(n-1)
with ProcessPoolExecutor() as e:
fibs = e.map(fib, range(10))
for v in fibs:
print(v)
!21
24. def func(n):
s = 0
for i in range(n): s += i
with ThreadPoolExecutor() as e:
e.map(func, range(3))
!24