numpy处理数据的记录

  1. 浅拷贝和深拷贝
    a = np.array([1, 6])
    b = a		# 引用
    print(b)	# [1 6]
    a[0] = 2
    print(b)	# [2 6]
    b[1] = 3
    print(a)	# [2 3]
    
    b = a.copy()	# 复制
    
  2. 插入一行(一列)
    a = np.array([[1, 9, 2], [5, 6, 3]])
    a = np.vstack((a, [0, 0, 0]))	# 尾部插入一行
    # a = np.hstack((a, [[0], [0]]))	# 最右端插入一列
    
  3. reshape
    a = np.arange(12)
    a = np.reshape(a, (3, 4))
    a = a.reshape(2, 6)
    
  4. 待定

你可能感兴趣的:(Python,-,学习)