Skip to content

Latest commit

 

History

History
29 lines (22 loc) · 1.02 KB

how-do-i-use-scipy-zeros-in-python.md

File metadata and controls

29 lines (22 loc) · 1.02 KB

How do I use Scipy zeros in Python?

// plain

Scipy zeros is a function in Python that creates a new array of given shape and type, filled with zeros. It is part of the SciPy library, which is a collection of numerical algorithms and domain-specific toolboxes.

Example code

import scipy.zeros
x = scipy.zeros((3,3))

Output example

array([[0., 0., 0.],
       [0., 0., 0.],
       [0., 0., 0.]])

The code above creates an array of shape 3x3, filled with zeros.

The code consists of two parts:

  • import scipy.zeros imports the Scipy zeros function from the SciPy library.
  • x = scipy.zeros((3,3)) creates a new array of shape 3x3, filled with zeros, and assigns it to the variable x.

Helpful links

onelinerhub: How do I use Scipy zeros in Python?