场景: 矩阵A(n*1),矩阵B(n*m), 实现 A&B
报错:TypeError: ufunc 'bitwise_and' not supported for the input types
原因: 两个矩阵的类型不同,A矩阵为 int64, B矩阵为float64, 与运算要求为int类型
解决1: B.astype(np.int64)
解决2:使用 np.logical_and (A,B)
场景: 矩阵A(n*1),矩阵B(n*m), 实现 A&B
报错:TypeError: ufunc 'bitwise_and' not supported for the input types
原因: 两个矩阵的类型不同,A矩阵为 int64, B矩阵为float64, 与运算要求为int类型
解决1: B.astype(np.int64)
解决2:使用 np.logical_and (A,B)