numpy 1.22.4 Pypi GitHub Homepage
Other Docs
ParametersBackRef
asarray(obj, itemsize=None, unicode=None, order=None)

Versus a regular NumPy array of type :None:None:`str` or :None:None:`unicode`, this class adds the following functionality:

  1. values automatically have whitespace removed from the end when indexed

  2. comparison operators automatically remove whitespace from the end when comparing values

  3. vectorized string operations are provided as methods (e.g. :None:None:`str.endswith`) and infix operators (e.g. + , * ,``%``)

Parameters

obj : array of str or unicode-like
itemsize : int, optional

:None:None:`itemsize` is the number of characters per scalar in the resulting array. If :None:None:`itemsize` is None, and :None:None:`obj` is an object array or a Python list, the :None:None:`itemsize` will be automatically determined. If :None:None:`itemsize` is provided and :None:None:`obj` is of type str or unicode, then the :None:None:`obj` string will be chunked into :None:None:`itemsize` pieces.

unicode : bool, optional

When true, the resulting chararray can contain Unicode characters, when false only 8-bit characters. If unicode is None and :None:None:`obj` is one of the following:

  • a chararray ,

  • an ndarray of type :None:None:`str` or 'unicode`

  • a Python str or unicode object,

then the unicode setting of the output array will be automatically determined.

order : {'C', 'F'}, optional

Specify the order of the array. If order is 'C' (default), then the array will be in C-contiguous order (last-index varies the fastest). If order is 'F', then the returned array will be in Fortran-contiguous order (first-index varies the fastest).

Convert the input to a chararray , copying the data only if necessary.

Examples

See :

Back References

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

numpy.chararray

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 : /numpy/core/defchararray.py#2746
type: <class 'function'>
Commit: