numpy.fromiter() in Python

The fromiter() function of Python numpy class creates a ndarray by using an iterable object. It returns a one-dimensional ndarray object.



The numpy.frombuffer() method consists of three parameters, which are as follows:

  1. Iterable: This parameter represents an iterable object.
  2. dtype: It represents the data type of the resultant array items.
  3. count: This functiondepicts the number of items to read from the buffer in the specified array.


This function returns an array created by using the iterable object.

Example 1


Pin It on Pinterest

Share This