This is documentation for an old release of NumPy (version 1.6.0). Read this page in the documentation of the latest stable release (version > 1.17).
Create a new 1-dimensional array from an iterable object.
Parameters : | iterable : iterable object
dtype : data-type
count : int, optional
|
---|---|
Returns : | out : ndarray
|
Notes
Specify count to improve performance. It allows fromiter to pre-allocate the output array, instead of resizing it on demand.
Examples
>>> iterable = (x*x for x in range(5))
>>> np.fromiter(iterable, np.float)
array([ 0., 1., 4., 9., 16.])