numpy.frombuffer() in Python

The frombuffer()  function of Python numpy class creates an array by using the given buffer.

Syntax

Parameter

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

  1. buffer: This parameter represents an object that depicts a buffer interface.
  2. dtype: It represents the data type of the returned data type array. It is an optional parameter, and by default,its value is 0.
  3. count: It represents the length of the returned ndarray. It is an optional parameter, and its default value is -1.
  4. offset: It represents the starting position to read from. It is also an optional parameter, and its default value is 0.

Return

This function returns the array version of the buffer.

Example 1

Output

Pin It on Pinterest

Share This