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. .. note:: The `chararray` class exists for backwards compatibility with Numarray, it is not recom
| 1921 | |
| 1922 | @set_module('numpy') |
| 1923 | class chararray(ndarray): |
| 1924 | """ |
| 1925 | chararray(shape, itemsize=1, unicode=False, buffer=None, offset=0, |
| 1926 | strides=None, order=None) |
| 1927 | |
| 1928 | Provides a convenient view on arrays of string and unicode values. |
| 1929 | |
| 1930 | .. note:: |
| 1931 | The `chararray` class exists for backwards compatibility with |
| 1932 | Numarray, it is not recommended for new development. Starting from numpy |
| 1933 | 1.4, if one needs arrays of strings, it is recommended to use arrays of |
| 1934 | `dtype` `object_`, `bytes_` or `str_`, and use the free functions |
| 1935 | in the `numpy.char` module for fast vectorized string operations. |
| 1936 | |
| 1937 | Versus a regular NumPy array of type `str` or `unicode`, this |
| 1938 | class adds the following functionality: |
| 1939 | |
| 1940 | 1) values automatically have whitespace removed from the end |
| 1941 | when indexed |
| 1942 | |
| 1943 | 2) comparison operators automatically remove whitespace from the |
| 1944 | end when comparing values |
| 1945 | |
| 1946 | 3) vectorized string operations are provided as methods |
| 1947 | (e.g. `.endswith`) and infix operators (e.g. ``"+", "*", "%"``) |
| 1948 | |
| 1949 | chararrays should be created using `numpy.char.array` or |
| 1950 | `numpy.char.asarray`, rather than this constructor directly. |
| 1951 | |
| 1952 | This constructor creates the array, using `buffer` (with `offset` |
| 1953 | and `strides`) if it is not ``None``. If `buffer` is ``None``, then |
| 1954 | constructs a new array with `strides` in "C order", unless both |
| 1955 | ``len(shape) >= 2`` and ``order='F'``, in which case `strides` |
| 1956 | is in "Fortran order". |
| 1957 | |
| 1958 | Methods |
| 1959 | ------- |
| 1960 | astype |
| 1961 | argsort |
| 1962 | copy |
| 1963 | count |
| 1964 | decode |
| 1965 | dump |
| 1966 | dumps |
| 1967 | encode |
| 1968 | endswith |
| 1969 | expandtabs |
| 1970 | fill |
| 1971 | find |
| 1972 | flatten |
| 1973 | getfield |
| 1974 | index |
| 1975 | isalnum |
| 1976 | isalpha |
| 1977 | isdecimal |
| 1978 | isdigit |
| 1979 | islower |
| 1980 | isnumeric |