摘要: 元组 创建:tup 注意tuple的数据是不可变的,但是列表作为tuple的值,列表的内容是可变的。 >>tup = 4, 5, 6 (4, 5, 6) >>nested_tup = (4, 5, 6), (7, 8) ((4, 5, 6), (7, 8)) >>tuple([4, 0, 2]) ( 阅读全文
posted @ 2021-01-14 15:15 dlage 阅读(13) 评论(0) 推荐(0) 编辑
摘要: 先给出结论: >>> a = np.array([[1, 2], [3, 4]]) >>> np.mean(a) # 将上面二维矩阵的每个元素相加除以元素个数(求平均数) 2.5 >>> np.mean(a, axis=0) # axis=0,计算每一列的均值 array([ 2., 3.]) >> 阅读全文
posted @ 2021-01-14 10:47 dlage 阅读(37) 评论(0) 推荐(0) 编辑