8000 DOC: Add examples to ``np.char`` by luxedo · Pull Request #26642 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

DOC: Add examples to np.char #26642

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Oct 14, 2024
Prev Previous commit
Next Next commit
DOC: add char.array example
[skip actions][skip azp][skip cirrus]
  • Loading branch information
luxedo committed Jun 8, 2024
commit ecc8b96a00a87ff6f12baa40048c4238d2c5c625
943E
10 changes: 10 additions & 0 deletions numpy/_core/defchararray.py
Original file line number Diff line number Diff line change
Expand Up @@ -1259,6 +1259,16 @@ class adds the following functionality:
fastest). If order is 'A', then the returned array may
be in any order (either C-, Fortran-contiguous, or even
discontiguous).

Examples
--------
>>> np.char.array(["a", "b", "c"])
chararray(['a', 'b', 'c'], dtype='<U1')
>>> np.char.array(["a", "b", "c"], itemsize=8)
array(['a', 'b', 'c'], dtype='<U8')
>>> np.char.array([1, 2, 3])
chararray([b'1', b'2', b'3'], dtype='|S1')

"""
if isinstance(obj, (bytes, str)):
if unicode is None:
Expand Down
0