numpy 1.22.4 Pypi GitHub Homepage
Other Docs
ParametersRaisesReturnsBackRef
fromstring(string, dtype=float, count=-1, *, sep, like=None)

Parameters

string : str

A string containing the data.

dtype : data-type, optional

The data type of the array; default: float. For binary input data, the data must be in exactly this format. Most builtin numeric types are supported and extension types may be supported.

versionadded

Complex dtypes.

count : int, optional

Read this number of dtype elements from the data. If this is negative (the default), the count will be determined from the length of the data.

sep : str, optional

The string separating numbers in the data; extra whitespace between elements is also ignored.

deprecated

Passing sep='' , the default, is deprecated since it will trigger the deprecated binary mode of this function. This mode interprets :None:None:`string` as binary bytes, rather than ASCII text with decimal numbers, an operation which is better spelt frombuffer(string, dtype, count) . If :None:None:`string` contains unicode text, the binary mode of :None:None:`fromstring` will first encode it into bytes using either utf-8 (python 3) or the default encoding (python 2), neither of which produce sane results.

like : array_like

Reference object to allow the creation of arrays which are not NumPy arrays. If an array-like passed in as like supports the __array_function__ protocol, the result will be defined by it. In this case, it ensures the creation of an array object compatible with that passed in via this argument.

versionadded

Raises

ValueError

If the string is not the correct size to satisfy the requested dtype and :None:None:`count`.

Returns

arr : ndarray

The constructed array.

A new 1-D array initialized from text data in a string.

See Also

frombuffer
fromfile
fromiter

Examples

>>> np.fromstring('1 2', dtype=int, sep=' ')
array([1, 2])
>>> np.fromstring('1, 2', dtype=int, sep=',')
array([1, 2])
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

numpy.fromregex numpy.loadtxt numpy.rec.array

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : None#None
type: <class 'builtin_function_or_method'>
Commit: