# python-scipyHow do I create a zero matrix using Python and Numpy?

Creating a zero matrix using Python and Numpy is a common operation. To do this, first import the numpy library.

`import numpy as np`

Then, use the `np.zeros`

function to create a zero matrix. This function takes a single argument which is a tuple that specifies the shape of the matrix. For example, to create a 3x4 matrix, the following code can be used:

```
zero_matrix = np.zeros((3, 4))
print(zero_matrix)
```

## Output example

```
[[0. 0. 0. 0.]
[0. 0. 0. 0.]
[0. 0. 0. 0.]]
```

The code consists of the following parts:

`import numpy as np`

imports the numpy library and assigns it the alias`np`

`np.zeros`

creates a matrix filled with zeros. It takes a single argument which is a tuple that specifies the shape of the matrix`print(zero_matrix)`

prints the created matrix

## Helpful links

### More of Python Scipy

- How do I use Python XlsxWriter to write a NumPy array to an Excel file?
- How do I create a 2D array of zeros using Python and NumPy?
- How can I use the x.shape function in Python Numpy?
- How can I check if a certain version of Python is compatible with SciPy?
- How do I convert a Python numpy array to a list?
- How do I use the scipy ttest_ind function in Python?
- How can I use SciPy in Python with the help of W3Schools tutorials?
- How do I use the trapz function in Python SciPy?
- How can I use Python Scipy to solve a Poisson equation?
- How do I use scipy.optimize.curve_fit in Python?

See more codes...