On this page
numpy.core.defchararray.array
- numpy.core.defchararray.array(obj, itemsize=None, copy=True, unicode=None, order=None)[source]
- 
    Create a chararray.Note This class is provided for numarray backward-compatibility. New code (not concerned with numarray compatibility) should use arrays of type string_orunicode_and use the free functions innumpy.charfor fast vectorized string operations instead.Versus a regular NumPy array of type strorunicode, this class adds the following functionality:- values automatically have whitespace removed from the end when indexed
- comparison operators automatically remove whitespace from the end when comparing values
- vectorized string operations are provided as methods (e.g. str.endswith) and infix operators (e.g.+, *, %)
 - Parameters
- 
      - objarray of str or unicode-like
- itemsizeint, optional
- 
        itemsizeis the number of characters per scalar in the resulting array. Ifitemsizeis None, andobjis an object array or a Python list, theitemsizewill be automatically determined. Ifitemsizeis provided andobjis of type str or unicode, then theobjstring will be chunked intoitemsizepieces.
- copybool, optional
- 
        If true (default), then the object is copied. Otherwise, a copy will only be made if __array__ returns a copy, if obj is a nested sequence, or if a copy is needed to satisfy any of the other requirements ( itemsize, unicode,order, etc.).
- unicodebool, optional
- 
        When true, the resulting chararraycan contain Unicode characters, when false only 8-bit characters. If unicode is None andobjis one of the following:- a chararray,
- an ndarray of type strorunicode
- a Python str or unicode object,
 then the unicode setting of the output array will be automatically determined. 
- a 
- order{‘C’, ‘F’, ‘A’}, 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). If order is ‘A’, then the returned array may be in any order (either C-, Fortran-contiguous, or even discontiguous). 
 
 
© 2005–2020 NumPy Developers
Licensed under the 3-clause BSD License.
 https://numpy.org/doc/1.19/reference/generated/numpy.core.defchararray.array.html