MCPcopy Index your code
hub / github.com/numpy/numpy / chararray

Class chararray

numpy/_core/defchararray.py:405–1217  ·  view source on GitHub ↗

chararray(shape, itemsize=1, unicode=False, buffer=None, offset=0, strides=None, order=None) Provides a convenient view on arrays of string and unicode values. .. deprecated:: 2.5 ``chararray`` is deprecated. Use an ``ndarray`` with a string or bytes dtype

Source from the content-addressed store, hash-verified

403
404@set_module("numpy.char")
405class chararray(ndarray):
406 """
407 chararray(shape, itemsize=1, unicode=False, buffer=None, offset=0,
408 strides=None, order=None)
409
410 Provides a convenient view on arrays of string and unicode values.
411
412 .. deprecated:: 2.5
413 ``chararray`` is deprecated. Use an ``ndarray`` with a string or
414 bytes dtype instead.
415
416 .. note::
417 The `chararray` class exists for backwards compatibility with
418 Numarray, it is not recommended for new development. Starting from numpy
419 1.4, if one needs arrays of strings, it is recommended to use arrays of
420 `dtype` `~numpy.object_`, `~numpy.bytes_` or `~numpy.str_`, and use
421 the free functions in the `numpy.char` module for fast vectorized
422 string operations.
423
424 Versus a NumPy array of dtype `~numpy.bytes_` or `~numpy.str_`, this
425 class adds the following functionality:
426
427 1) values automatically have whitespace removed from the end
428 when indexed
429
430 2) comparison operators automatically remove whitespace from the
431 end when comparing values
432
433 3) vectorized string operations are provided as methods
434 (e.g. `.endswith`) and infix operators (e.g. ``"+", "*", "%"``)
435
436 chararrays should be created using `numpy.char.array` or
437 `numpy.char.asarray`, rather than this constructor directly.
438
439 This constructor creates the array, using `buffer` (with `offset`
440 and `strides`) if it is not ``None``. If `buffer` is ``None``, then
441 constructs a new array with `strides` in "C order", unless both
442 ``len(shape) >= 2`` and ``order='F'``, in which case `strides`
443 is in "Fortran order".
444
445 Methods
446 -------
447 astype
448 argsort
449 copy
450 count
451 decode
452 dump
453 dumps
454 encode
455 endswith
456 expandtabs
457 fill
458 find
459 flatten
460 getfield
461 index
462 isalnum

Callers 1

arrayFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…