Python 3 crumbs tagged with #numpy

Creating 2D and 3D multidimensional arrays with NumPy

Creating 2D and 3D multidimensional arrays with NumPy

Nov 11, 2022 by erik

We can create ndarrays using the np.array function. We need to use nested lists to introduce the extra dimensions. As you can see when running this example, the output (when using print) can become a bit hard to read. This...

numpy array 2D 3D
NumPy 1D array creation with the copy option

NumPy 1D array creation with the copy option

Nov 8, 2022 by erik

When creating NumPy arrays, the copy argument controls whether a copy of the input object is made or not. When copy is True, any changes in the resulting array will not change the input object. However, if it is False,...

numpy array
NumPy float types: a demonstration of precision

NumPy float types: a demonstration of precision

Oct 11, 2022 by erik

The different NumPy float types allow us to store floats in different precision, dependent on the number of bits we allow the float to use. The larger the number of allowed bits, the more precision our array’s elements will have....

numpy float