Movatterモバイル変換


[0]ホーム

URL:


SciPy

numpy.ndarray.flat

ndarray.flat

A 1-D iterator over the array.

This is anumpy.flatiter instance, which acts similarly to, but is nota subclass of, Python’s built-in iterator object.

See also

flatten
Return a copy of the array collapsed into one dimension.

flatiter

Examples

>>>x=np.arange(1,7).reshape(2,3)>>>xarray([[1, 2, 3],       [4, 5, 6]])>>>x.flat[3]4>>>x.Tarray([[1, 4],       [2, 5],       [3, 6]])>>>x.T.flat[3]5>>>type(x.flat)<type 'numpy.flatiter'>

An assignment example:

>>>x.flat=3;xarray([[3, 3, 3],       [3, 3, 3]])>>>x.flat[[1,4]]=1;xarray([[3, 1, 3],       [3, 1, 3]])

Previous topic

numpy.ndarray.imag

Next topic

numpy.ndarray.ctypes

Quick search

  • © Copyright 2008-2018, The SciPy community.
  • Last updated on Jul 24, 2018.
  • Created usingSphinx 1.6.6.

[8]ページ先頭

©2009-2025 Movatter.jp