July 2018
Beginner to intermediate
406 pages
9h 55m
English
So, let's import NumPy and play with it a bit. For that, we need to start the Python interactive shell:
>>> import numpy>>> numpy.version.full_version 1.13.3
As we do not want to pollute our namespace, we certainly should not use the following code:
>>> from numpy import *
If we do this, then, for instance, numpy.array will potentially shadow the array package that is included in standard Python. Instead, we will use the following convenient shortcut:
>>> import numpy as np>>> a = np.array([0,1,2,3,4,5])>>> aarray([0, 1, 2, 3, 4, 5])>>> a.ndim 1>>> a.shape (6,)
With the previous code snippet, we created an array in the same way that we would create a list in Python. However, the NumPy arrays have additional information about ...
Read now
Unlock full access