diff --git a/content/numpy/concepts/built-in-functions/terms/append/append.md b/content/numpy/concepts/built-in-functions/terms/append/append.md index 20069ca8e0a..ae1bc35378d 100644 --- a/content/numpy/concepts/built-in-functions/terms/append/append.md +++ b/content/numpy/concepts/built-in-functions/terms/append/append.md @@ -52,3 +52,26 @@ This produces the following output: [4 5 6] [7 8 9]] ``` + +## Codebyte Example + +The following example creates two arrays and demonstrates appending them using `.append()`, both without specifying an axis (resulting in a 1D array) and along specified axes (rows and columns): + +```codebyte/python +import numpy as np + +nd1 = np.array([[0,0,0,0], [1,1,1,1]]) +print("First array: \n", nd1) + +nd2 = np.arange(8).reshape(2, 4) +print("Second array: \n", nd2) + +nd3 = np.append(nd1, nd2) +print("Appended array with no axis specified:\n", nd3); + +nd4 = np.append(nd1, nd2, axis = 0) +print("Appended array on axis 0:\n", nd4); + +nd5 = np.append(nd1, nd2, axis = 1) +print("Appended array on axis 1:\n", nd5); +```