# NumPy in 9 minutes

Numpy is a powerful open-source library used for scientific computing and data analysis. This article will provide a crash course on Numpy and help beginners get up and running quickly.

# Set Up

To use NumPy, you will need to install it first. You can install NumPy using pip, a package manager for Python:

`pip install numpy`

Once installed, you can import it and set the seed for reproducibility:

`import numpy as np`

# setting the seed for reproducibility

# Basics

In NumPy, a scalar is a single numerical value, a vector is a one-dimensional array, a matrix is a two-dimensional array, and a tensor is a multi-dimensional array. Here is an example of creating each of these using NumPy:

`# Scalar`

s = np.array(5)

print(s)

# Vector

v = np.array([1, 2, 3])

print(v)

# Matrix

m = np.array([[1, 2, 3], [4, 5, 6]])

print(m)

# Tensor

t = np.array([[[1, 2], [3, 4]], [[5, 6], [7, 8]]])

print(t)

Output

`5`

[1 2 3]

[[1 2 3]

[4 5 6]]

[[[1 2]

[3 4]]

[[5 6]

[7 8]]]

You can access information about your NumPy array using the following methods:

`print("arr ndim: ", arr.ndim) # number of dimensions`

print("arr shape:", arr.shape) # dimensions…