Let’s see how to append to empty array in Numpy Python module.

Little reminder. We already discussed how to create empty array in Numpy. We used following code:

import numpy as np empty_array = np.empty((3, 3)) print(empty_array)

To append to empty array just use append Numpy function.

import numpy as np empty_array = np.empty((3, 3)) new_array = np.append(empty_array, 6) print(new_array)

Using append function I’ve added 6.

To append empty array more and add more values just use parentheses.

import numpy as np empty_array = np.empty((3, 3)) new_array = np.append(empty_array, (6, 3)) print(new_array)

This is how your array looks like. If you don’t like what you see you can reshape it now.

import numpy as np empty_array = np.empty((3, 3)) new_array = np.append(empty_array, (6, 3, 4)) reshape = new_array.reshape(4, 3) print(reshape)