This function is used to create a ndarray by using an iterable object. It returns a one-dimensional ndarray object.
numpy.fromiter(iterable, dtype, count = - 1)
It accepts the following parameters.
An array created by using the iterable object is returned.
import numpy as np list = [0,2,4,6] it = iter(list) x = np.fromiter(it, dtype = float) print(x) print(type(x))
Output: