1.使用numpy實現特徵值特徵向量的求解
import numpy as np
a = np.random.randint(10, 20, 9).reshape(3, 3)
print(a)
b = np.random.randint(10, 20, 9).reshape(3, 3)
print(b)
c = a.dot(b)
print(c)
# 求特徵值和特徵向量
eigenvalue, featurevector = np.linalg.eig(c)
print(eigenvalue)
print("*" * 20)
print(featurevector)
eigenvalue是特徵值
featurevector是特徵向量
2.對於一組二維數據
選區前三行和前三列可以不使用iloc和loc語句
直接使用.head(3)可直接選區前三行前三列
3.在使用matplotlib作圖時,有時候座標軸的負號會不顯示
這時候在導入的matplotlib語句中插入這句指令
import matplotlib.pyplot as plt
plt.rcParams['axes.unicode_minus']=False
座標軸的負號就可以顯示了