Skip to content

Commit ecc8b96

Browse files
committed
DOC: add char.array example
[skip actions][skip azp][skip cirrus]
1 parent 7d8de93 commit ecc8b96

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

numpy/_core/defchararray.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,6 +1259,16 @@ class adds the following functionality:
12591259
fastest). If order is 'A', then the returned array may
12601260
be in any order (either C-, Fortran-contiguous, or even
12611261
discontiguous).
1262+
1263+
Examples
1264+
--------
1265+
>>> np.char.array(["a", "b", "c"])
1266+
chararray(['a', 'b', 'c'], dtype='<U1')
1267+
>>> np.char.array(["a", "b", "c"], itemsize=8)
1268+
array(['a', 'b', 'c'], dtype='<U8')
1269+
>>> np.char.array([1, 2, 3])
1270+
chararray([b'1', b'2', b'3'], dtype='|S1')
1271+
12621272
"""
12631273
if isinstance(obj, (bytes, str)):
12641274
if unicode is None:

0 commit comments

Comments
 (0)