numpy add one column code example
Example 1: add a new column to numpy array
import numpy as np
N = 10
a = np.random.rand(N,N)
b = np.zeros((N,N+1))
b[:,:-1] = a
Example 2: numpy add one column
an_array = np.append(an_array, new_column, axis=1)
import numpy as np
N = 10
a = np.random.rand(N,N)
b = np.zeros((N,N+1))
b[:,:-1] = a
an_array = np.append(an_array, new_column, axis=1)