numpy.fromstring () in Python

The fromstring() function of Python numpy class creates a new 1-D array initialized from raw binary or text data in a string.



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

string: It represents a string containing the data.

dtype: It is an optional parameter. It depicts the data type of returned array, and by default, it is a float.

count: This parameter readsthe number of dtype elements from the data. It is an optional parameter, and If this is negative (the default), the count will be determined from the length of the data.

sep: It represents the string separating numbers in the data wherein the extra whitespace between elements is also ignored.



Pin It on Pinterest

Share This