To add data from a new numpy.ndarray with shape (6, 28, 28) at the end of an existing numpy.ndarray with shape (10000, 28, 28) in Python, you can use the numpy.concatenate() function.
Here's an example of how to do it:
main.py404 chars14 lines
In the example above, we first create the existing_array with shape (10000, 28, 28) and initialize it with zeros. Then, we create the new_array with shape (6, 28, 28) and initialize it with ones.
Finally, we use the np.concatenate() function to concatenate the arrays along the first axis (axis=0), which corresponds to adding the new_array at the end of the existing_array. The resulting array is stored in the variable result.
gistlibby LogSnag