AI engineering glossary · NumPy pandas visualization

What is np.zeros and np.ones?

np.zeros and np.ones (also called np.zeros, np.ones): Functions that create an array of a given shape filled entirely with 0s or 1s. They are used to preallocate space for results, to initialise weights or counters, and to build masks. Companion functions np.full and np.empty do the same with a chosen value or unset memory.

Level: beginnerTopic: NumPy pandas visualization

np.zeros and np.ones: an example

np.zeros((3, 4)) creates a 3 by 4 array of zeros; np.ones(5, dtype=int) creates five integer ones.

Related terms

More NumPy pandas visualization terms

Where you learn it

np.zeros and np.ones is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.