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
| 1823 | |
| 1824 | @set_module('numpy') |
| 1825 | class chararray(ndarray): |
| 1826 | """ |
| 1827 | chararray(shape, itemsize=1, unicode=False, buffer=None, offset=0, |
| 1828 | strides=None, order=None) |
| 1829 | |
| 1830 | Provides a convenient view on arrays of string and unicode values. |
| 1831 | |
| 1832 | .. note:: |
| 1833 | The `chararray` class exists for backwards compatibility with |
| 1834 | Numarray, it is not recommended for new development. Starting from numpy |
| 1835 | 1.4, if one needs arrays of strings, it is recommended to use arrays of |
| 1836 | `dtype` `object_`, `string_` or `unicode_`, and use the free functions |
| 1837 | in the `numpy.char` module for fast vectorized string operations. |
| 1838 | |
| 1839 | Versus a regular NumPy array of type `str` or `unicode`, this |
| 1840 | class adds the following functionality: |
| 1841 | |
| 1842 | 1) values automatically have whitespace removed from the end |
| 1843 | when indexed |
| 1844 | |
| 1845 | 2) comparison operators automatically remove whitespace from the |
| 1846 | end when comparing values |
| 1847 | |
| 1848 | 3) vectorized string operations are provided as methods |
| 1849 | (e.g. `.endswith`) and infix operators (e.g. ``"+", "*", "%"``) |
| 1850 | |
| 1851 | chararrays should be created using `numpy.char.array` or |
| 1852 | `numpy.char.asarray`, rather than this constructor directly. |
| 1853 | |
| 1854 | This constructor creates the array, using `buffer` (with `offset` |
| 1855 | and `strides`) if it is not ``None``. If `buffer` is ``None``, then |
| 1856 | constructs a new array with `strides` in "C order", unless both |
| 1857 | ``len(shape) >= 2`` and ``order='Fortran'``, in which case `strides` |
| 1858 | is in "Fortran order". |
| 1859 | |
| 1860 | Methods |
| 1861 | ------- |
| 1862 | astype |
| 1863 | argsort |
| 1864 | copy |
| 1865 | count |
| 1866 | decode |
| 1867 | dump |
| 1868 | dumps |
| 1869 | encode |
| 1870 | endswith |
| 1871 | expandtabs |
| 1872 | fill |
| 1873 | find |
| 1874 | flatten |
| 1875 | getfield |
| 1876 | index |
| 1877 | isalnum |
| 1878 | isalpha |
| 1879 | isdecimal |
| 1880 | isdigit |
| 1881 | islower |
| 1882 | isnumeric |