numpy 1.22.4 Pypi GitHub Homepage
Other Docs
ParametersReturnsBackRef
ones(shape, dtype=None, order='C', *, like=None)

Parameters

shape : int or sequence of ints

Shape of the new array, e.g., (2, 3) or 2 .

dtype : data-type, optional

The desired data-type for the array, e.g., numpy.int8 . Default is numpy.float64 .

order : {'C', 'F'}, optional, default: C

Whether to store multi-dimensional data in row-major (C-style) or column-major (Fortran-style) order in memory.

like : array_like

Reference object to allow the creation of arrays which are not NumPy arrays. If an array-like passed in as like supports the __array_function__ protocol, the result will be defined by it. In this case, it ensures the creation of an array object compatible with that passed in via this argument.

versionadded

Returns

out : ndarray

Array of ones with the given shape, dtype, and order.

Return a new array of given shape and type, filled with ones.

See Also

empty

Return a new uninitialized array.

full

Return a new array of given shape filled with value.

ones_like

Return an array of ones with shape and type of input.

zeros

Return a new array setting values to zero.

Examples

>>> np.ones(5)
array([1., 1., 1., 1., 1.])
>>> np.ones((5,), dtype=int)
array([1, 1, 1, 1, 1])
>>> np.ones((2, 1))
array([[1.],
       [1.]])
>>> s = (2,2)
... np.ones(s) array([[1., 1.], [1., 1.]])
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

scipy

10 Elements
scipy.sparse.csgraph._flow.maximum_flow
scipy.optimize._optimize.approx_fprime
scipy.signal._spectral_py.check_NOLA
scipy.fft._basic.hfftn
scipy.spatial._geometric_slerp.geometric_slerp
scipy.fft._basic.rfftn
scipy.linalg._decomp_cholesky.cho_solve_banded
scipy.signal._signaltools.correlate
scipy.fft._basic.ihfftn
scipy.linalg._basic.matmul_toeplitz

skimage

18 Elements
skimage.restoration.uft.uirfft2
skimage.measure.fit.ransac
skimage.restoration.uft.uirfftn
skimage.restoration.uft.uifftn
skimage.restoration.uft.urfftn
skimage.restoration.uft.ufftn
skimage.restoration.uft.image_quad_norm
skimage.restoration.deconvolution.wiener
skimage.segmentation._watershed.watershed
skimage.restoration.uft.ir2tf
skimage.restoration.uft.ufft2
skimage.morphology._util._offsets_to_raveled_neighbors
skimage.transform.integral.integrate
skimage.restoration.deconvolution.unsupervised_wiener
skimage.restoration.deconvolution.richardson_lucy
skimage.restoration.uft.urfft2
skimage.restoration.uft.uifft2
skimage.filters._unsharp_mask.unsharp_mask

numpy

numpy.zeros
numpy.full
numpy.array
numpy.ones_like
numpy.empty

dask

10 Elements
dask.array.reductions.sum
dask.array.routines.average
dask.array.routines.outer
dask.array.fft.fft_wrap.<locals>.func
dask.array.chunk_types.register_chunk_type
dask.array.core.load_store_chunk
dask.array.ufunc.equal
dask.array.einsumfuncs.einsum
dask.array.ufunc.hypot
dask.array.routines.transpose

pandas

pandas.core.frame.DataFrame.memory_usage

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /numpy/core/numeric.py#149
type: <class 'function'>
Commit: