numpy矩阵转置只需要这样子:
import numpy as np
import fractions
# 设置以分数形式显示
np.set_printoptions(formatter={'all': lambda x: str(fractions.Fraction(x).limit_denominator())})
# 定义矩阵
c = np.array([[-1/np.sqrt(2), 0, 1/np.sqrt(2)], [0, 1, 0], [1/np.sqrt(2), 0, 1/np.sqrt(2)]])
# 矩阵转置
ct = c.T
print(ct)