iT邦幫忙

0

每日一篇學習筆記 直到我做完專題 :( [Day35]

  • 分享至 

  • xImage
  •  

今天學python的numpy
主要就是練習各種用法

import numpy as np
'''
array_1d = np.array
print(array_1d)

array_2d = np.array([[1,2],[3,4]])
print(array_2d)

zero = np.zeros((3,3))
print(zero)

one = np.ones((4,5))
print(one)

random_array = np.random.random((6,4))
print(random_array)

linspace_array = np.linspace(0,10,3)
print(linspace_array)

array = np.array([[1,2,3],[4,5,6]])

print(array.shape)
print(array.ndim)
print(array.size)
print(array.dtype)

'''

a = np.array([1,2,3])
b = np.array([3,2,1])

print(a+b)
print(a-b)
print(a*b)
print(a/b)

A = np.array([[1,2],[3,4]])
B = np.array([[5,6],[7,8]])

print(np.dot(A,B))
print(np.dot(B,A))

array = np.array([[1,2,3],[4,5,6]])
print(array.sum())
print(array.mean())

print(array.min())
print(array.max())

print(array.sum(axis=0))
print(array.sum(axis=1))

print(array[0,1])
print(array[:,0])

print(array[array>3])

圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言