Initialization
So far in this book, we encountered several convenient functions for intializing arrays. The full()
and full_like()
functions were recently added to NumPy to make initialization even easier.
The following short Python session shows (abbreviated) documentation for these two functions:
$ python >>> import numpy as np >>> help(np.full) Return a new array of given shape and type, filled with `fill_value`. >>> help(np.full_like)
Return a full array with the same shape and type as a given array.