Class NDCharArray
- Namespace
- NumSharp
- Assembly
- NumSharp.dll
NumPy's numpy.char.chararray: a string array (S or U) whose single elements come back with
their trailing whitespace stripped (c[0] of ['ab '] is 'ab') and whose views and copies
stay chararrays. Create one with chararray(Shape, long, bool, object, long, long[], char), array(object, long?, bool, bool?, char?) or
asarray(object, long?, bool?, char?), or view an existing string array with
view(DType, Type). NumPy keeps the class for backward compatibility with Numarray and
recommends plain S / U arrays and the np.char / np.strings functions for new code.
public class NDCharArray : NDArray, IIndex, ICloneable, IDisposable, IEnumerable
- Inheritance
-
NDCharArray
- Implements
- Inherited Members
- Extension Methods
Remarks
Members and indexers follow the static type. They are chosen by the compiler when the expression is typed NDCharArray. The same object through an NDArray reference is a plain string array: its indexer returns an unstripped 0-d view and its members return plain arrays.
Element access strips. An index that names one element (an integer per axis) returns a READ-ONLY 0-d
NDCharArray holding the element's text with Python's rstrip() applied: the 29 Unicode
whitespace code points for U, the 6 ASCII ones for S (trailing NULs are padding and go too). It is
NumSharp's stand-in for the Python str / bytes NumPy returns. Iterating a 1-d chararray yields the
stripped values as string / byte[]. item(long),
tolist() and flatiter's single elements do NOT strip, as in NumPy.
The finalize rule. A chararray can be created only over S, U or int8 data
(NumPy's dtype.char in 'VSUbc'; NumSharp's char dtype reports 'c' and passes too). Any
member whose result would have another dtype raises ValueError
(Can only create a chararray from string data.): astype(int), view(type: typeof(NDCharArray))
of a numeric array. view(DType) is the exception NumPy has: it checks the dtype the array HAS, then
changes it, so c.view(np.uint32) is a uint32 chararray — whose own views and copies then raise.
Lifetime. A chararray is an NDArray: it holds one counted reference on its buffer and is released with Dispose() or an NDScope. A chararray that views another array keeps that array's buffer alive.
Constructors
NDCharArray(UnmanagedStorage)
Wraps storage as a chararray WITHOUT the finalize rule and without copying. Callers check
the rule first (Finalize(DType)) and pass a storage object no other array wraps: an in-place
shape change of either array would otherwise show through the other.
public NDCharArray(UnmanagedStorage storage)
Parameters
storageUnmanagedStorageThe storage to wrap; its shape becomes the chararray's shape.
Remarks
The constructor a subclass of the chararray chains to (: base(storage)). To build a chararray from data,
use np.char.array / np.char.asarray: they apply NumPy's finalize rule, which this constructor
skips, so a numeric storage here gives a chararray NumPy refuses (Can only create a chararray from string
data.).
Exceptions
- NullReferenceException
storageisnull.
Fields
__name__
NumPy's class name (chararray.name), for its error texts; NumSharp.Build's weave reads it to
find the array subclasses and name them in the generated method dispatch.
protected const string __name__ = "chararray"
Field Value
Properties
this[object[]]
NumPy's chararray.getitem(obj) as the one C# indexer: every index NumPy takes (integers, slices,
slice notation, index arrays, boolean masks, sequences, in any mix), with chararray's rule for the result — an
element is stripped of trailing whitespace, an array stays a chararray. A boolean array from a comparison is an
index too: c[c != ""].
public NDCharArray this[params object[] key] { get; set; }
Parameters
keyobject[]The index tuple (one entry per C# argument; a Slice[] or
object[]passed alone is the tuple itself, and a single C# tuple entry is spread). A slice-notation string may hold several comma-separated entries (c[":, ::-1"],c["0, 1"]); the empty string is NumPy's empty indexc[()].
Property Value
- NDCharArray
GET: the element as a read-only 0-d stand-in, its trailing whitespace stripped (NumPy's Python
str/bytes), for a full integer index (one integer or 0-d integer array per axis; for a 0-d chararray the empty index); otherwise a chararray VIEW for an index of integers and slices, a chararray view of the gathered array (OWNDATA false) for an index array or a mask, and an owning chararray copy for NumPy's 0-d-integer-array-plus-slices case. SET: stores through the plain array rule (NumPy's chararray does not overridesetitem): truncated to the element width,Sencodes ASCII.
Remarks
The C# type. The indexer has one type for get and set. It is typed NDCharArray so that
c["1:3"][0] and c2[0][1] strip like NumPy's chained indexing, therefore the value assigned through
it is an NDCharArray or a C# string / byte[] (implicit conversions). Assign
any other value (a number, a plain NDArray) with __setitem__(object, object).
Static, not virtual. This indexer HIDES this[object[]] instead of overriding it: chararray's rule applies through an NDCharArray reference, and through an NDArray reference a chararray is indexed as a plain array (the library's own code receives chararrays as NDArray and relies on that; the public functions answer for the class, see NumSharp.NDSubclass).
Dispatch. One integer (a C# integer of any type C# converts to long) reads the element
straight from the strides for a 1-d S / U chararray (ElementOrRow(long), the body of the old
this[int] / this[long]); an index of integers, slices and slice strings selects its view without
building an intermediate array (GetBasic(Slice[])); any other index goes through the plain array's advanced
indexing first, whose result the scope reclaims once the chararray holds its own reference.
Exceptions
- ArgumentNullException
keyisnull, or an entry isnull.- IndexError
An index is out of bounds, too many entries, a mask that does not match, or index arrays that do not broadcast together (NumPy's texts).
- ValueError
(get) The chararray holds data that is not string data and the index selects an array; (set) the chararray is read-only, or the value does not fit the selection.
- SystemError
(get) A
Uelement holds a unit aboveU+10FFFF.
ReprClassName
The class name NumPy's repr() prints before the opening parenthesis: array for an
ndarray, the subclass name for a subclass (type(arr).name in
_array_repr_implementation). Override it in a subclass that NumPy prints under another name;
the continuation lines and a wrapped dtype= suffix are aligned to this name's length, so it
changes the layout of the whole repr, not the first word alone.
protected override string ReprClassName { get; }
Property Value
- string
The name without the parenthesis. Never
nullor empty.
Remarks
A subclass declared outside NumSharp.dll overrides it as protected override; NumPy prints a
user subclass under its own name, which is what such an override should return.
T
NumPy's c.T: the transpose, as a chararray.
public NDCharArray T { get; }
Property Value
- NDCharArray
A view with the axes reversed (writes reach this chararray).
Remarks
Built straight on the storage (the engine's transposed shape over a new alias): the same view
base.transpose() returns, without its intermediate array (a third of the cost of a 1K c.T).
Exceptions
- ValueError
This chararray holds data that is not string data.
imag
The imaginary part, as a chararray: for string data a READ-ONLY chararray of the same dtype and shape holding empty strings (NumPy's zero-filled subclass array). Assigning raises: there is no imaginary part to set.
public NDCharArray imag { get; set; }
Property Value
- NDCharArray
A new read-only chararray that owns its (empty) data.
Exceptions
- ValueError
(get) This chararray holds data that is not string data.
- TypeError
(set) Always for string data (
array does not have imaginary part to set).
mT
NumPy's c.mT: the two last axes exchanged, as a chararray.
public NDCharArray mT { get; }
Property Value
- NDCharArray
A view.
Exceptions
- ArgumentException
Fewer than two axes (
matrix transpose with ndim < 2 is undefined).- ValueError
This chararray holds data that is not string data.
real
The real part, as a chararray: for string data the chararray ITSELF (NumPy's c.real is c). Assigning
stores into it.
public NDCharArray real { get; set; }
Property Value
- NDCharArray
This chararray.
Exceptions
- ValueError
(set) The chararray is read-only, or the value does not broadcast.
Methods
Clone()
A deep copy that is a chararray again (NumPy's copy.copy(c), a KEEPORDER copy made as the subclass).
It HIDES Clone() and does not override it, on purpose: library code that clones an array it
holds as NDArray must get a plain array back.
public NDCharArray Clone()
Returns
- NDCharArray
A new chararray that owns a copy of the data.
Exceptions
- ValueError
This chararray holds data that is not string data (a
view(np.uint32)).
Equals(object)
Value equality, as for NDArray: true when every element compares equal (unstripped) after
broadcasting. Declared because this class declares ==.
public override bool Equals(object obj)
Parameters
objobjectThe object to compare with.
Returns
- bool
truewhen all elements are equal;falsefornull.
GetEnumerator()
Iterates the first axis as NumPy's chararray does (each step is c[i]): a 1-d chararray yields its
elements STRIPPED, as string for U and byte[] for S; a chararray with more
axes yields its rows as chararray VIEWS.
public IEnumerator GetEnumerator()
Returns
- IEnumerator
An enumerator over the first axis.
Remarks
A 1-d chararray over int8 / char data yields its elements as the base array does (boxed numbers). Rows of a
chararray over data that is not string data raise the finalize ValueError at the first row, as
NumPy's first next() does.
An array with rows of length 0 still yields its rows ((2, 0) yields two empty chararrays), where
iterating a plain NDArray of that shape yields nothing.
Each row holds a counted reference on the buffer: dispose the rows in a hot loop, or iterate inside an NDScope.
Exceptions
- TypeError
The chararray is 0-d (
iteration over a 0-d array).
GetHashCode()
Always throws: an array is mutable and therefore unhashable, as in NumPy.
public override int GetHashCode()
Returns
- int
Never returns.
Exceptions
- NotSupportedException
Always.
NanMax(int?, NDArray, bool, object, NDArray)
np.nanmax of a chararray: NumPy's nanmax sends any operand that is not a base ndarray down its branch for
subclasses, and text is not inexact, so _replace_nan returns no mask and the answer is
np.amax(a, axis=axis, out=out, **kwargs) of the chararray itself: its refusal names maximum, where
a plain text array's np.nanmax names fmax. An element's scalar stand-in is a NumPy scalar, computed as a
base ndarray.
protected override NDArray NanMax(int? axis, NDArray @out, bool keepdims, object initial, NDArray where)
Parameters
axisint?The axis to reduce, or
nullfor every axis.outNDArrayNumPy's
out=, ornull.keepdimsboolWhether the reduced axes stay with length one.
initialobjectNumPy's
initial=, ornull.whereNDArrayNumPy's
where=bool mask, ornull.
Returns
- NDArray
np.amax's answer for the chararray (its woven path decides the class).
Remarks
NumPy's own statement hands the chararray to np.amax, whose woven subclass path answers for the class; np.amax never comes back to this member, so the class's rule of computing on its plain view does not apply here.
NoInlining | NoOptimization: this frame
is where the test-time caller audit (NDSubclass.Audit) stops, since an override of a
NumSharp.SubclassAwareAttribute member hands the chararray on by design. Optimized code inlines np.amax
here and turns the call into a tail jump to np.<amax>subclass, which takes this frame off the
stack, and the audit then reports np.nanmax as a library caller: PR #633's CI, ubuntu net10.0, once this
member reached tier 1 (tail.jmp in its JIT listing on linux-x64). Unoptimized, the call stays a
call; the cost is nil, as the text case always ends in np.amax's TypeError.
Exceptions
- TypeError
np.amax's:
ufunc 'maximum' did not contain a loop with signature matching typesfor fixed-width text, as in NumPy.- AxisError
axisis out of bounds.
NanMin(int?, NDArray, bool, object, NDArray)
np.nanmin of a chararray: NumPy's branch for subclasses, which for text (no NaN mask) is
np.amin(a, axis=axis, out=out, **kwargs) of the chararray itself (see NanMax(int?, NDArray, bool, object, NDArray)).
protected override NDArray NanMin(int? axis, NDArray @out, bool keepdims, object initial, NDArray where)
Parameters
axisint?The axis to reduce, or
nullfor every axis.outNDArrayNumPy's
out=, ornull.keepdimsboolWhether the reduced axes stay with length one.
initialobjectNumPy's
initial=, ornull.whereNDArrayNumPy's
where=bool mask, ornull.
Returns
- NDArray
np.amin's answer for the chararray.
Remarks
As for NanMax(int?, NDArray, bool, object, NDArray), the chararray itself is NumPy's operand of np.amin, and this frame must
stay on the stack for the caller audit (the same MethodImplAttribute, for the same tail
jump to np.<amin>subclass).
Exceptions
- TypeError
np.amin's:
ufunc 'minimum' did not contain a loop with signature matching typesfor fixed-width text.- AxisError
axisis out of bounds.
__array_finalize__(DType)
chararray.array_finalize's dtype check for a result about to be created as a chararray
(np.zeros_like(c, dtype), np.argmax(c)'s int64 index).
protected override void __array_finalize__(DType dtype)
Parameters
dtypeDTypeThe result's dtype.
Exceptions
- ValueError
The dtype is not string data (
Can only create a chararray from string data.).
__array_finalize__(NDArray, bool, NewSubtypeZeroDim)
NumPy's creation of a result as a chararray (Py_TYPE(self), then chararray.array_finalize,
which refuses a dtype that is not string data): a chararray over created, owning its data
exactly when the result does; a 0-d result as NumPy hands it back (NewSubtypeZeroDim).
protected override NDArray __array_finalize__(NDArray created, bool keepRank, NewSubtypeZeroDim zeroDim)
Parameters
createdNDArrayThe result computed plain.
keepRankboolUnused: the chararray finalize rule changes no shape.
zeroDimNewSubtypeZeroDimHow a 0-d result reaches the caller: a 0-d chararray, the unstripped NumPy scalar (
PyArray_Return), or the stripped element (getitem).
Returns
- NDArray
createdwhen it is a chararray, else the chararray (or scalar stand-in) over it.
Exceptions
- ValueError
The dtype is not string data (
Can only create a chararray from string data.).
__array_wrap__(NDArray)
NumPy's chararray.array_wrap(arr): "we return a chararray if the result is a string dtype;
otherwise a plain ndarray" - a NEW chararray view of a text result (also of an operand or out= handed back,
np.add(c, c, out=co) is co is False), any other result unchanged.
protected override NDArray __array_wrap__(NDArray array)
Parameters
arrayNDArrayThe result to wrap.
Returns
- NDArray
A new chararray view of a text
array, elsearray.
__getitem__(object)
NumPy's chararray.getitem(obj): the same as c[obj] (see this[object[]]).
public NDCharArray __getitem__(object obj)
Parameters
objobjectThe index as Python passes it: one entry (an integer, slice notation, a Slice, an index array, a mask) or the whole index tuple — an
object[]/ Slice[] or a C# tuple. A typed C# array other than Slice[] (int[],bool[]) is ONE entry, NumPy's list.
Returns
- NDCharArray
The stripped 0-d stand-in for a full integer index, a chararray (view, gathered view or copy) otherwise.
Remarks
One member, NumPy's signature (it replaced the int, long, string and
params int[] forms; coordinates are a tuple: c.getitem((1, 2))).
Exceptions
- ArgumentNullException
objisnull.- IndexError
An index is out of bounds, more entries than axes, or an invalid index.
- ValueError
The chararray holds data that is not string data and the result is an array.
- SystemError
A
Uelement holds a unit aboveU+10FFFF.
__iter__()
Python's iter(c): the same as GetEnumerator().
public IEnumerator __iter__()
Returns
- IEnumerator
An enumerator over the first axis (stripped elements of a 1-d chararray, chararray rows otherwise).
Exceptions
- TypeError
The chararray is 0-d.
argmax()
NumPy's chararray.argmax(): always the finalize error, because NumPy creates the index as a chararray
— after its own checks (an empty array raises attempt to get argmax of an empty sequence first).
public long argmax()
Returns
- long
Never returns.
Remarks
Through an NDArray reference the same object computes the plain index (the static rule).
Exceptions
- ValueError
An empty chararray (
attempt to get argmax of an empty sequence); otherwise alwaysCan only create a chararray from string data.
argmax(int, bool)
NumPy's chararray.argmax(axis, keepdims=...): the finalize error, after NumPy's axis and empty-sequence
checks.
public NDArray argmax(int axis, bool keepdims = false)
Parameters
Returns
- NDArray
Never returns.
Exceptions
- AxisError
axisis outside the array's rank (rank 1 for a 0-d chararray).- ValueError
The reduced length is 0 (
attempt to get argmax of an empty sequence); elseCan only create a chararray from string data.
argmax(int?, NDArray, bool)
NumPy's chararray.argmax(axis=None, out=None, *, keepdims=False): with out the
indices are written into it and it is returned (nothing is created as the subclass); without it, the
finalize error after NumPy's checks.
public NDArray argmax(int? axis = null, NDArray @out = null, bool keepdims = false)
Parameters
axisint?The axis, or null for the flattened array.
outNDArrayThe output array, or null.
keepdimsboolNumPy's
keepdims.
Returns
- NDArray
out.
Exceptions
- AxisError
axisis outside the array's rank.- ValueError
The reduced length is 0,
outhas another shape (output array does not match result of np.argmax.), or — withoutout— alwaysCan only create a chararray from string data.- TypeError
out's dtype does not cast safely to int64.
argmin()
NumPy's chararray.argmin(): always the finalize error, after the empty-sequence check.
public long argmin()
Returns
- long
Never returns.
Exceptions
- ValueError
An empty chararray (
attempt to get argmin of an empty sequence); otherwise alwaysCan only create a chararray from string data.
argmin(int, bool)
NumPy's chararray.argmin(axis, keepdims=...): the finalize error after NumPy's checks.
public NDArray argmin(int axis, bool keepdims = false)
Parameters
Returns
- NDArray
Never returns.
Exceptions
- AxisError
axisis outside the array's rank.- ValueError
The reduced length is 0; else
Can only create a chararray from string data.
argmin(int?, NDArray, bool)
NumPy's chararray.argmin(axis=None, out=None, *, keepdims=False): computes into out;
without it, the finalize error after NumPy's checks.
public NDArray argmin(int? axis = null, NDArray @out = null, bool keepdims = false)
Parameters
axisint?The axis, or null for the flattened array.
outNDArrayThe output array, or null.
keepdimsboolNumPy's
keepdims.
Returns
- NDArray
out.
Exceptions
- AxisError
axisis outside the array's rank.- ValueError
The reduced length is 0,
outhas another shape, or — withoutout— alwaysCan only create a chararray from string data.- TypeError
out's dtype does not cast safely to int64.
argpartition(NDArray, int?, string, string)
NumPy's chararray.argpartition(kth, axis=-1, kind='introselect', order=None): always the finalize
error, after NumPy's checks of the kind, the order, the axis and the kth bounds (skipped for an empty array).
public NDArray argpartition(NDArray kth, int? axis = -1, string kind = "introselect", string order = null)
Parameters
kthNDArrayNumPy's
kth: one index (a C# integer) or a sequence of them (a C# integer array, an integer NDArray) to partition by.axisint?The axis, or null for the flattened array.
kindstringThe selection algorithm (only
'introselect').orderstringMust be null.
Returns
- NDArray
Never returns.
Remarks
One member, NumPy's signature: every argpartition(NDArray, int?, string, string) call form converts to this NDArray parameter, so none of NDArray's argpartition overloads binds through a chararray.
Exceptions
- ValueError
A bad kind or kth (
kth(=9) out of bounds (4)); otherwise alwaysCan only create a chararray from string data.- AxisError
axisis outside the array's rank.- TypeError
A non-integer kth array.
astype(DType, bool)
A copy of the chararray cast to dtype, as a chararray (NumPy's c.astype(dtype)).
public NDCharArray astype(DType dtype, bool copy = true)
Parameters
dtypeDTypeThe target dtype: a string dtype (an unsized
"U"/"S"keeps the element width), orint8(the one numeric dtype the finalize rule accepts).copyboolfalsereturns this chararray ITSELF when it already has the dtype.
Returns
- NDCharArray
A new chararray that owns its data, or this chararray.
Exceptions
- ArgumentNullException
dtypeisnull.- ValueError
The dtype is not string data (
Can only create a chararray from string data.), raised BEFORE any element is converted, as NumPy allocates the subclass result before its cast loop.- UnicodeEncodeError
A
U→Scast of a non-ASCII character.- UnicodeDecodeError
An
S→Ucast of a byte above 0x7F.
astype(DType, bool, char, string)
A copy of the chararray cast to dtype with a memory order and a casting rule, as a
chararray.
public NDCharArray astype(DType dtype, bool copy, char order, string casting = "unsafe")
Parameters
dtypeDTypeThe target dtype (see astype(DType, bool)).
copyboolfalsereturns this chararray itself when nothing has to change.orderchar'C','F','A'or'K'.castingstringNumPy's casting rule name (
"unsafe","same_kind","safe","equiv","no").
Returns
- NDCharArray
A new chararray that owns its data, or this chararray.
Exceptions
- ArgumentNullException
dtypeisnull.- InvalidCastException
The cast is not allowed under
casting(checked first, as NumPy does).- ValueError
The dtype is not string data (the finalize rule, after the casting rule and before any element is converted), or an unknown order / casting name.
- UnicodeEncodeError
A
U→Scast of a non-ASCII character.- UnicodeDecodeError
An
S→Ucast of a byte above 0x7F.
byteswap(bool)
The chararray with its bytes swapped, as a chararray (NumPy's c.byteswap(inplace)): every 4-byte
code unit of a U chararray reversed (the result usually holds units above U+10FFFF), an S
chararray unchanged.
public NDCharArray byteswap(bool inplace = false)
Parameters
inplacebooltrueswaps this chararray's own bytes and returns this chararray.
Returns
- NDCharArray
A new chararray that owns its data, or this chararray when
inplaceistrue.
Exceptions
- ValueError
inplaceon a read-only chararray, or a copy of a chararray that holds data that is not string data.
capitalize()
NumPy's chararray.capitalize(): asarray(capitalize(self)), each element's first character in
titlecase and the rest lowered, over the stored text (a chararray's trailing whitespace included).
public NDCharArray capitalize()
Returns
- NDCharArray
A chararray of this array's dtype and shape: owning its data for
U, a view of the computed array forS(NumPy'snp.char.asarrayrule); 0-d for a 0-d chararray.
Remarks
See capitalize(object) for the function.
Exceptions
- SystemError
A
Uelement holding a code unit past U+10FFFF.
center(object, object)
NumPy's chararray.center(width, fillchar=' '): every element centered in a string of
width characters, padded with fillchar — the stored text, unstripped, so
trailing whitespace is part of what is centered.
public NDCharArray center(object width, object fillchar = null)
Parameters
widthobjectThe widths: an integer array or a C# integer, broadcast against the elements.
fillcharobjectThe one-character fills, broadcast; null is NumPy's default
' '(astrfill is cast to bytes for anSchararray, abytesfill to text for aUone).
Returns
- NDCharArray
A chararray at the widest result width, laid out like this array: owning its data for
U, a view of the computed array forS(NumPy'snp.char.asarrayrule). With aStringDTypefill beside a chararray NumPy's trivial loop does not copy (larger than 1-d, or 1-d pastnp.getbufsize()elements), the function'sStringDTyperesult asnp.char.asarraymakes it: anSchararray (its text encoded as ASCII).
Remarks
NumPy's member is asarray(center(self, width, fillchar)); see
center(object, object, object) for the function.
Exceptions
- ArgumentNullException
widthis null.- TypeError
A
widththat is not an integer array (unsupported type float64 for operand 'width'); a fill that is not one character (The fill character must be exactly one character long); a uint64 width.- ValueError
An empty array (
zero-size array to reduction operation maximum which has no identity, NumPy's sizing); aStringDTypefill when this chararray (or a chararray fill) is 0-d, or 1-d with at mostnp.getbufsize()elements: NumPy's trivial loop copies it intoStringDType()as a chararray (Can only create a chararray from string data.).- UnicodeEncodeError
A non-ASCII fill for an
Schararray; non-ASCII text in theStringDTyperesultnp.char.asarrayencodes.- IncorrectShapeException
An argument does not broadcast.
compress(NDArray, int?, NDCharArray)
The elements where condition is true, as a chararray (NumPy's
c.compress(condition, axis, out)); without an axis the flattened elements.
public NDCharArray compress(NDArray condition, int? axis = null, NDCharArray @out = null)
Parameters
conditionNDArrayA 1-d bool array.
axisint?The axis to select along, or
null.outNDCharArrayNumPy's
out=: a chararray of the result's shape that receives the elements and is returned, or null. A plain NDArray out binds compress(NDArray, int?, NDArray) instead and returns that array, as NumPy returns itsoutwhatever its class.
Returns
- NDCharArray
A new chararray that owns its data, or
out.
Remarks
One member, NumPy's signature.
Exceptions
- ValueError
conditionis not 1-d, or this chararray holds data that is not string data; NumPy's out= errors (compress is a take of the condition's nonzero indices:output array does not match result of ndarray.take).- IndexError
conditionis longer than the axis.- AxisError
axisis out of bounds.
copy(char)
A copy of the chararray, as a chararray (NumPy's c.copy(order)).
public NDCharArray copy(char order = 'C')
Parameters
orderchar'C','F','A'or'K'.
Returns
- NDCharArray
A new chararray that owns its data.
Remarks
The result is allocated as a chararray and filled in place — ndarray.copy's layout
(NDIter.CopyAsShape) and fill (NDIter.Copy) without the plain intermediate array; NumPy's order:
the order is checked before the copy exists, the finalize rule when it is created.
Exceptions
- ArgumentException
An unknown order.
- ValueError
This chararray holds data that is not string data.
count(object, object, object)
NumPy's chararray.count(sub, start=0, end=None): the number of non-overlapping occurrences of
sub in every element's [start:end] range — the stored text, unstripped, so trailing
whitespace is searched too.
public NDArray count(object sub, object start = null, object end = null)
Parameters
subobjectThe substrings, broadcast against the elements: this array's class (a
bytessubstring for aUchararray, astrone for anSchararray or a number has no loop).startobjectThe range starts in slice notation (negative counts from the end), any integer dtype, broadcast; null is NumPy's default 0.
endobjectThe range ends in slice notation, broadcast; null is NumPy's
None(the whole string).
Returns
- NDArray
A plain int64 array of the broadcast shape (0-d for a 0-d chararray).
Remarks
NumPy's member is count(self, sub, start, end); see count(object, object, object, object) for the
function.
Exceptions
- ArgumentNullException
subis null.- TypeError
No loop for the classes (NumPy's
ufunc 'count' did not contain a loop with signature matching types ...).- TypeError
A start / end that cannot reach int64 by a same_kind cast (a float or text:
Cannot cast ufunc 'count' input 2 from dtype('float64') to dtype('int64') with casting rule 'same_kind').- OverflowException
A start / end literal past int64.
- IncorrectShapeException
An argument does not broadcast.
decode(object, object)
NumPy's chararray.decode(encoding=None, errors=None): CPython's bytes.decode per element of this
S chararray's stored bytes (trailing whitespace included, trailing NULs dropped), the results as a plain
U array.
public NDArray decode(object encoding = null, object errors = null)
Parameters
encodingobjectThe codec name, or null for UTF-8; broadcast against this array (see decode(object, object, object)).
errorsobjectThe error handler, or null for
strict; ignored whenencodingis null.
Returns
- NDArray
A fresh C-ordered PLAIN
Uarray of the broadcast shape (0-d for a 0-d chararray), as wide as the longest decoding (at least 1).
Remarks
NumPy's member is decode(self, encoding, errors); see decode(object, object, object) for the
function.
Exceptions
- AttributeError
A
Uchararray:type object 'str' has no attribute 'decode'.- TypeError
An argument that is not a str;
xmlcharrefreplace/namereplaceat an error.- ValueError
An argument holding a NUL; a ragged argument list.
- UnicodeDecodeError
Bytes the codec cannot decode under
strict, or a handler that re-raises it.- UnicodeEncodeError
A surrogate in an argument.
- UnicodeError
The
undefinedcodec over a non-empty element.- LookupError
An unknown or non-text codec; an unknown handler name at the first error.
- IncorrectShapeException
An argument does not broadcast.
- NotSupportedException
A Python codec NumSharp does not implement.
diagonal(int, int, int)
The diagonal, as a chararray (NumPy's c.diagonal(offset, axis1, axis2)).
public NDCharArray diagonal(int offset = 0, int axis1 = 0, int axis2 = 1)
Parameters
offsetint0 for the main diagonal, positive above it, negative below.
axis1intThe first axis of the plane.
axis2intThe second axis of the plane.
Returns
- NDCharArray
A READ-ONLY view of the diagonal.
Exceptions
- AxisError
An axis is out of bounds.
- ArgumentException
The two axes are the same.
- ValueError
This chararray holds data that is not string data.
encode(object, object)
NumPy's chararray.encode(encoding=None, errors=None): CPython's str.encode per element of this
U chararray's stored text (trailing whitespace included), the results as a plain S array.
public NDArray encode(object encoding = null, object errors = null)
Parameters
encodingobjectThe codec name, or null for UTF-8; broadcast against this array (see encode(object, object, object)).
errorsobjectThe error handler, or null for
strict; ignored whenencodingis null.
Returns
- NDArray
A fresh C-ordered PLAIN
Sarray of the broadcast shape (0-d for a 0-d chararray), as wide as the longest encoding (at least 1).
Remarks
NumPy's member is encode(self, encoding, errors); see encode(object, object, object) for the
function.
Exceptions
- AttributeError
An
Schararray:type object 'bytes' has no attribute 'encode'.- TypeError
An argument that is not a str.
- ValueError
An argument holding a NUL; a ragged argument list.
- UnicodeEncodeError
A character the codec cannot encode under
strict, or a handler that re-raises it.- UnicodeError
The
undefinedcodec.- LookupError
An unknown or non-text codec; an unknown handler name at the first error.
- SystemError
An element of one unit past U+10FFFF.
- IncorrectShapeException
An argument does not broadcast.
- NotSupportedException
A Python codec NumSharp does not implement.
endswith(object, object, object)
NumPy's chararray.endswith(suffix, start=0, end=None): whether every element's [start:end] range
ends with suffix — the stored text, unstripped, so endswith(' ') is True for an
element stored with trailing spaces.
public NDArray endswith(object suffix, object start = null, object end = null)
Parameters
suffixobjectThe suffixes, broadcast against the elements (this array's class).
startobjectThe range starts in slice notation, broadcast; null is NumPy's default 0.
endobjectThe range ends in slice notation, broadcast; null is NumPy's
None.
Returns
- NDArray
A plain bool array of the broadcast shape (0-d for a 0-d chararray).
Exceptions
- ArgumentNullException
suffixis null.- TypeError
No loop for the classes.
- TypeError
A start / end that cannot reach int64 by a same_kind cast.
- OverflowException
A start / end literal past int64.
- IncorrectShapeException
An argument does not broadcast.
expandtabs(object)
NumPy's chararray.expandtabs(tabsize=8): every tab replaced by spaces up to the next multiple of
tabsize columns (the column restarts after '\n' and '\r').
public NDCharArray expandtabs(object tabsize = null)
Parameters
tabsizeobjectThe tab sizes (any integer dtype), broadcast; null is NumPy's default 8.
Returns
- NDCharArray
A chararray at NumPy's result width (a tab's columns plus every other character's BYTES, so a
Uresult is wider than its text): owning its data forU, a view of the computed array forS.
Exceptions
- TypeError
A tab size that cannot reach int64 by a same_kind cast (a float).
- ValueError
An empty array.
- IncorrectShapeException
tabsizedoes not broadcast.- OverflowException
An expanded string longer than 2^31 - 1.
find(object, object, object)
NumPy's chararray.find(sub, start=0, end=None): for every element, the lowest index where
sub occurs inside its [start:end] range, or -1 (the stored text, unstripped).
public NDArray find(object sub, object start = null, object end = null)
Parameters
subobjectThe substrings, broadcast against the elements (this array's class).
startobjectThe range starts in slice notation, broadcast; null is NumPy's default 0.
endobjectThe range ends in slice notation, broadcast; null is NumPy's
None.
Returns
- NDArray
A plain int64 array of the broadcast shape (0-d for a 0-d chararray).
Exceptions
- ArgumentNullException
subis null.- TypeError
No loop for the classes.
- TypeError
A start / end that cannot reach int64 by a same_kind cast.
- OverflowException
A start / end literal past int64.
- IncorrectShapeException
An argument does not broadcast.
flatten(char)
A COPY of the elements as one axis, as a chararray (NumPy's c.flatten(order)).
public NDCharArray flatten(char order = 'C')
Parameters
orderchar'C','F','A'or'K'.
Returns
- NDCharArray
A new 1-d chararray that owns its data.
Exceptions
- ArgumentException
An unknown order.
- ValueError
This chararray holds data that is not string data.
getfield(DType, int)
A field of each element read as dtype at a byte offset, as a chararray view (NumPy's
c.getfield(dtype, offset)): getfield("U1", 4) is the second character of each U element.
public NDCharArray getfield(DType dtype, int offset = 0)
Parameters
dtypeDTypeThe dtype of the field; it must be string data (or int8), since NumPy builds the subclass view with it.
offsetintThe byte offset inside each element.
Returns
- NDCharArray
A view of the field.
Exceptions
- ArgumentNullException
dtypeisnull.- ValueError
The field does not fit inside an element (NumPy's texts, checked first), or the field's dtype is not string data.
index(object, object, object)
NumPy's chararray.index(sub, start=0, end=None): find(object, object, object), but an element with no match
raises ValueError: substring not found.
public NDArray index(object sub, object start = null, object end = null)
Parameters
subobjectThe substrings, broadcast against the elements (this array's class).
startobjectThe range starts in slice notation, broadcast; null is NumPy's default 0.
endobjectThe range ends in slice notation, broadcast; null is NumPy's
None.
Returns
- NDArray
A plain int64 array of the broadcast shape (0-d for a 0-d chararray).
Exceptions
- ArgumentNullException
subis null.- TypeError
No loop for the classes.
- TypeError
A start / end that cannot reach int64 by a same_kind cast.
- OverflowException
A start / end literal past int64.
- IncorrectShapeException
An argument does not broadcast.
- ValueError
An element without a match (
substring not found).
isalnum()
NumPy's chararray.isalnum(): isalnum(self), the ufunc over the stored text. True for each
element whose text has at least one character and only alphanumeric characters (CPython's
str.isalnum: alphabetic, decimal, digit or numeric); 'a1' is True; a stored 'ab '
is False (its trailing spaces are not alphanumeric).
public NDArray isalnum()
Returns
- NDArray
A plain bool array of this array's shape (0-d for a 0-d chararray).
Remarks
See isalnum(object, NDArray, NDArray, DType) for the function.
isalpha()
NumPy's chararray.isalpha(): isalpha(self), the ufunc over the stored text. True for each
element whose text has at least one character and only alphabetic characters (CPython's
str.isalpha: the Unicode letter categories); 'abc' is True; a stored 'ab ' is
False, though its element c[i] reads 'ab'.
public NDArray isalpha()
Returns
- NDArray
A plain bool array of this array's shape (0-d for a 0-d chararray).
Remarks
See isalpha(object, NDArray, NDArray, DType) for the function.
isdecimal()
NumPy's chararray.isdecimal(): isdecimal(self), the ufunc over the stored text. True for
each element whose text has at least one character and only decimal characters (CPython's
str.isdecimal: '٣' is one, '²' is not); '123' is True; a stored '12 '
is False.
public NDArray isdecimal()
Returns
- NDArray
A plain bool array of this array's shape (0-d for a 0-d chararray).
Remarks
See isdecimal(object, NDArray, NDArray, DType) for the function.
Exceptions
- TypeError
An
Schararray: NumPy's ufunc has no bytes loop (ufunc 'isdecimal' did not contain a loop with signature matching types <class 'numpy.dtypes.BytesDType'> -> None).
isdigit()
NumPy's chararray.isdigit(): isdigit(self), the ufunc over the stored text. True for each
element whose text has at least one character and only digits (CPython's str.isdigit: the decimal
digits and the other digits, such as '²'; not '½'); '123' is True; '½' is
False.
public NDArray isdigit()
Returns
- NDArray
A plain bool array of this array's shape (0-d for a 0-d chararray).
Remarks
See isdigit(object, NDArray, NDArray, DType) for the function.
islower()
NumPy's chararray.islower(): islower(self), the ufunc over the stored text. True for each
element whose text has at least one cased character and every cased character lowercase; a stored
'ab ' is True (spaces are uncased); 'aBc' is False.
public NDArray islower()
Returns
- NDArray
A plain bool array of this array's shape (0-d for a 0-d chararray).
Remarks
See islower(object, NDArray, NDArray, DType) for the function.
isnumeric()
NumPy's chararray.isnumeric(): isnumeric(self), the ufunc over the stored text. True for
each element whose text has at least one character and only numeric characters (CPython's
str.isnumeric: digits, fractions such as '½', Roman and CJK numerals); '½' is True;
'a1' is False.
public NDArray isnumeric()
Returns
- NDArray
A plain bool array of this array's shape (0-d for a 0-d chararray).
Remarks
See isnumeric(object, NDArray, NDArray, DType) for the function.
Exceptions
- TypeError
An
Schararray: NumPy's ufunc has no bytes loop (ufunc 'isnumeric' did not contain a loop with signature matching types <class 'numpy.dtypes.BytesDType'> -> None).
isspace()
NumPy's chararray.isspace(): isspace(self), the ufunc over the stored text. True for each
element whose text has at least one character and only whitespace (CPython's str.isspace for
U / StringDType; space and \t–\r for S); ' ' is True; an
empty element is False.
public NDArray isspace()
Returns
- NDArray
A plain bool array of this array's shape (0-d for a 0-d chararray).
Remarks
See isspace(object, NDArray, NDArray, DType) for the function.
istitle()
NumPy's chararray.istitle(): istitle(self), the ufunc over the stored text. True for each
element whose text is titlecased: an uppercase or titlecase character never follows a cased character, a
lowercase one always does, and at least one character is cased; 'Abc Def' is True; 'ABC'
is False.
public NDArray istitle()
Returns
- NDArray
A plain bool array of this array's shape (0-d for a 0-d chararray).
Remarks
See istitle(object, NDArray, NDArray, DType) for the function.
isupper()
NumPy's chararray.isupper(): isupper(self), the ufunc over the stored text. True for each
element whose text has at least one cased character and every cased character uppercase; a stored
'AB ' is True (spaces are uncased); 'Ab' is False.
public NDArray isupper()
Returns
- NDArray
A plain bool array of this array's shape (0-d for a 0-d chararray).
Remarks
See isupper(object, NDArray, NDArray, DType) for the function.
join(object)
NumPy's chararray.join(seq): np.char.join(self, seq) — the chararray's elements (unstripped) are
the SEPARATORS, each joining the characters of its seq string. The result is a plain text
array, as NumPy's np.asarray(result.tolist()) is.
public NDArray join(object seq)
Parameters
seqobjectThe strings, broadcast against this array: text, or an object array of lists (NDListArray), which NumPy 2.4.2 joins and then refuses (see join(object, object)).
Returns
- NDArray
The joined text (of
seq's class).
Remarks
One overload, NumPy's signature.
Exceptions
- TypeError
See join(object, object).
- SystemError
A one-unit
Useparator or sequence above U+10FFFF.- IncorrectShapeException
The arguments do not broadcast.
- NotSupportedException
NumPy's result is an empty object array (an empty broadcast of an object
seq), which an NDArray result cannot hold.
ljust(object, object)
NumPy's chararray.ljust(width, fillchar=' '): every element left-justified in a string of
width characters, padded on the right with fillchar (the stored text,
unstripped).
public NDCharArray ljust(object width, object fillchar = null)
Parameters
widthobjectThe integer widths, broadcast against the elements.
fillcharobjectThe one-character fills, broadcast; null is NumPy's default
' '.
Returns
- NDCharArray
A chararray at the widest result width: owning its data for
U, a view of the computed array forS(with aStringDTypefill NumPy's trivial loop does not copy, see center(object, object)).
Exceptions
- ArgumentNullException
widthis null.- TypeError
- ValueError
An empty array; a
StringDTypefill beside a chararray NumPy's trivial loop copies (see center(object, object)).- UnicodeEncodeError
A non-ASCII fill for an
Schararray.- IncorrectShapeException
An argument does not broadcast.
lower()
NumPy's chararray.lower(): asarray(lower(self)), each element's text lowercased (CPython's
str.lower for U, ASCII letters for S) over the stored text.
public NDCharArray lower()
Returns
- NDCharArray
A chararray of this array's dtype and shape: owning its data for
U, a view of the computed array forS; 0-d for a 0-d chararray.
Remarks
See lower(object) for the function.
Exceptions
- SystemError
A
Uelement holding a code unit past U+10FFFF.
lstrip(object)
NumPy's chararray.lstrip(chars=None): every element without its LEADING characters found in
chars (whitespace for null), over the stored text.
public NDCharArray lstrip(object chars = null)
Parameters
charsobjectThe characters to remove, as a set, broadcast (see strip(object)); null strips whitespace.
Returns
- NDCharArray
A chararray view of the stripped array, of this array's dtype.
Exceptions
- TypeError
No loop for the classes.
- ValueError
A
StringDTypeset when this chararray is 0-d, or 1-d with at mostnp.getbufsize()elements (NumPy's trivial-loop copy:Can only create a chararray from string data.).- NotSupportedException
A
StringDTypeset beside a larger chararray (NumPy's plainStringDTyperesult;np.char.lstripreturns it).- IncorrectShapeException
charsdoes not broadcast.
partition(NDArray, int?, string, string)
partition(int, int?, string, string) with the kth indices as an array: NumPy's TypeError.
public void partition(NDArray kth, int? axis, string kind = "introselect", string order = null)
Parameters
kthNDArrayThe kth indices.
axisint?The axis.
kindstringThe selection algorithm.
orderstringMust be null.
Exceptions
- TypeError
Always:
chararray.partition() got an unexpected keyword argument 'axis'.
partition(int, int?, string, string)
c.partition(kth, axis, ...), the call np.partition makes: NumPy's TypeError, because
chararray.partition takes only the separator.
public void partition(int kth, int? axis, string kind = "introselect", string order = null)
Parameters
kthintThe kth index of a sort partition.
axisint?The axis (its presence is what NumPy refuses).
kindstringThe selection algorithm.
orderstringMust be null.
Remarks
The axis has no default, so c.partition(1) binds the string partition, as in NumPy.
Exceptions
- TypeError
Always:
chararray.partition() got an unexpected keyword argument 'axis'.
partition(int[], int?, string, string)
partition(int, int?, string, string) with several kth indices: NumPy's TypeError.
public void partition(int[] kth, int? axis, string kind = "introselect", string order = null)
Parameters
kthint[]The kth indices.
axisint?The axis.
kindstringThe selection algorithm.
orderstringMust be null.
Exceptions
- TypeError
Always:
chararray.partition() got an unexpected keyword argument 'axis'.
partition(object)
NumPy's chararray.partition(sep): the STRING partition (np.char.partition: each element split
around the first sep into three parts), which hides ndarray's in-place sort partition.
The result adds a final axis of length three for the before, separator and after parts.
public NDCharArray partition(object sep)
Parameters
sepobjectThe separator, broadcast against the array's elements: a C# string (NumPy's Python
str), abyte[](Pythonbytes), or an array; it is cast to this array's dtype first.
Returns
- NDCharArray
A chararray containing the three parts of each element on its last axis, at the widest part's width, laid out as NumPy's
np.stacklays it out: a VIEW of the stacked parts for bytes, a COPY for str (NumPy'snp.char.asarraycompares a str array's width in characters with its itemsize in bytes and copies).
Remarks
NumPy's chararray.partition is asarray(partition(self, sep)) with numpy.char's
partition = np.stack(np.strings.partition(a, sep), axis=-1): the three parts (chararray views in NumPy,
as its ufunc hands them back) stacked into a plain array (np.concatenate keeps no subclass of equal
priority), seen as a chararray by np.char.asarray. partition(object, object) computes that
stacked array (plain parts: their class never reaches the stack's answer), and the array, private to the call,
takes its asarray form without a copy (AsArrayOfFresh(NDArray)).
Exceptions
- ArgumentNullException
sepis null.- ValueError
An empty separator (
empty separator); an empty array (zero-size array to reduction operation maximum which has no identity, NumPy's sizing).- TypeError
No
findloop for the classes (astrseparator beside a bytes chararray is cast, a number is not text).- UnicodeEncodeError
A non-ASCII separator for a bytes chararray.
- IncorrectShapeException
The separator does not broadcast.
ravel()
The elements as one axis, as a chararray (NumPy's c.ravel()): a VIEW when the layout allows it,
a copy otherwise.
public NDCharArray ravel()
Returns
- NDCharArray
A 1-d chararray.
Exceptions
- ValueError
This chararray holds data that is not string data.
ravel(char)
The elements as one axis, as a chararray (NumPy's c.ravel()): a VIEW when the layout allows it,
a copy otherwise.
public NDCharArray ravel(char order)
Parameters
orderchar'C','F','A'or'K'.
Returns
- NDCharArray
A 1-d chararray.
Exceptions
- ValueError
This chararray holds data that is not string data.
- ArgumentException
An unknown order.
repeat(NDArray, int?)
Each element repeated, as a chararray (NumPy's c.repeat(repeats, axis)); without an axis the
flattened elements.
public NDCharArray repeat(NDArray repeats, int? axis = null)
Parameters
repeatsNDArrayThe repeat counts: one C# integer for every element (
c.repeat(2), NumPy'snp.asarray(2)), or an integer array of one count per element of the axis.axisint?The axis to repeat along, or
null.
Returns
- NDCharArray
A new chararray that owns its data.
Remarks
One member, NumPy's signature: every repeat(NDArray, int?) call form converts to this NDArray parameter, so none of NDArray's repeat overloads binds through a chararray.
Exceptions
- ValueError
A negative count, counts that do not match the axis, or this chararray holds data that is not string data.
- AxisError
axisis out of bounds.
replace(object, object, object)
NumPy's chararray.replace(old, new, count=None): every element with its occurrences of
old replaced by new, left to right, at most count of
them, over the stored text.
public NDCharArray replace(object old, object @new, object count = null)
Parameters
oldobjectThe searched strings, broadcast: a C#
string/byte[](Python'sstr/bytes) is cast to this array's dtype first; an array keeps its own dtype.newobjectThe replacements, broadcast (the rule of
old).countobjectThe most replacements per element: an integer array or literal, broadcast; null is NumPy's
None, which the member passes as -1 (every occurrence).
Returns
- NDCharArray
A chararray view of the replaced array: this array's class at the widest result width.
Remarks
NumPy's member is replace(self, old, new, count if count is not None else -1): the module
function's null count is that same -1, so the member forwards it.
Exceptions
- ArgumentNullException
oldornewis null.- TypeError
countis not an integer array (unsupported type float64 for operand 'count'); no loop for the classes.- ValueError
A
StringDTypeold/newwhen this chararray is 0-d, or 1-d with at mostnp.getbufsize()elements (NumPy's trivial-loop copy:Can only create a chararray from string data.); a number cast to text.- NotSupportedException
A
StringDTypeold/newbeside a larger chararray: NumPy's member returns the function's PLAINStringDTypearray, which this member's NDCharArray type cannot hold (np.char.replacereturns it).- UnicodeEncodeError
A non-ASCII
old/newfor anSchararray.- IncorrectShapeException
An argument does not broadcast.
reshape(Shape)
The elements under another shape, as a chararray (NumPy's c.reshape(shape)).
public NDCharArray reshape(Shape newShape)
Parameters
newShapeShapeThe requested dimensions; one may be -1 (inferred).
Returns
- NDCharArray
A view when the layout allows it, otherwise a copy.
Exceptions
- IncorrectShapeException
The requested size differs from the chararray's size.
- ValueError
This chararray holds data that is not string data.
reshape(Shape, char)
The elements under another shape, as a chararray (NumPy's c.reshape(shape)).
public NDCharArray reshape(Shape newShape, char order)
Parameters
newShapeShapeThe requested dimensions; one may be -1 (inferred).
orderchar'C','F'or'A': the index order the elements are read and placed in.
Returns
- NDCharArray
A view when the layout allows it, otherwise a copy.
Exceptions
- IncorrectShapeException
The requested size differs from the chararray's size.
- ValueError
This chararray holds data that is not string data.
reshape(ref Shape)
The elements under another shape, as a chararray (NumPy's c.reshape(shape)).
public NDCharArray reshape(ref Shape newShape)
Parameters
newShapeShapeThe requested dimensions; one may be -1 (inferred).
Returns
- NDCharArray
A view when the layout allows it, otherwise a copy.
Exceptions
- IncorrectShapeException
The requested size differs from the chararray's size.
- ValueError
This chararray holds data that is not string data.
reshape(int[])
The elements under another shape, as a chararray (NumPy's c.reshape(shape)).
public NDCharArray reshape(int[] shape)
Parameters
shapeint[]The requested dimensions; one may be -1.
Returns
- NDCharArray
A view when the layout allows it, otherwise a copy.
Exceptions
- IncorrectShapeException
The requested size differs from the chararray's size.
- ValueError
This chararray holds data that is not string data.
reshape(params long[])
The elements under another shape, as a chararray (NumPy's c.reshape(shape)).
public NDCharArray reshape(params long[] shape)
Parameters
shapelong[]The requested dimensions; one may be -1.
Returns
- NDCharArray
A view when the layout allows it, otherwise a copy.
Exceptions
- IncorrectShapeException
The requested size differs from the chararray's size.
- ValueError
This chararray holds data that is not string data.
reshape(params ReadOnlySpan<long>)
The elements under another shape, as a chararray (NumPy's c.reshape(shape)).
public NDCharArray reshape(params ReadOnlySpan<long> shape)
Parameters
shapeReadOnlySpan<long>The requested dimensions; one may be -1.
Returns
- NDCharArray
A view when the layout allows it, otherwise a copy.
Exceptions
- IncorrectShapeException
The requested size differs from the chararray's size.
- ValueError
This chararray holds data that is not string data.
rfind(object, object, object)
NumPy's chararray.rfind(sub, start=0, end=None): for every element, the highest index where
sub occurs inside its [start:end] range, or -1 (the stored text, unstripped).
public NDArray rfind(object sub, object start = null, object end = null)
Parameters
subobjectThe substrings, broadcast against the elements (this array's class).
startobjectThe range starts in slice notation, broadcast; null is NumPy's default 0.
endobjectThe range ends in slice notation, broadcast; null is NumPy's
None.
Returns
- NDArray
A plain int64 array of the broadcast shape (0-d for a 0-d chararray).
Exceptions
- ArgumentNullException
subis null.- TypeError
No loop for the classes.
- TypeError
A start / end that cannot reach int64 by a same_kind cast.
- OverflowException
A start / end literal past int64.
- IncorrectShapeException
An argument does not broadcast.
rindex(object, object, object)
NumPy's chararray.rindex(sub, start=0, end=None): rfind(object, object, object), but an element with no match
raises ValueError: substring not found.
public NDArray rindex(object sub, object start = null, object end = null)
Parameters
subobjectThe substrings, broadcast against the elements (this array's class).
startobjectThe range starts in slice notation, broadcast; null is NumPy's default 0.
endobjectThe range ends in slice notation, broadcast; null is NumPy's
None.
Returns
- NDArray
A plain int64 array of the broadcast shape (0-d for a 0-d chararray).
Exceptions
- ArgumentNullException
subis null.- TypeError
No loop for the classes.
- TypeError
A start / end that cannot reach int64 by a same_kind cast.
- OverflowException
A start / end literal past int64.
- IncorrectShapeException
An argument does not broadcast.
- ValueError
An element without a match (
substring not found).
rjust(object, object)
NumPy's chararray.rjust(width, fillchar=' '): every element right-justified in a string of
width characters, padded on the left with fillchar (the stored text,
unstripped, so trailing whitespace stays at the right end).
public NDCharArray rjust(object width, object fillchar = null)
Parameters
widthobjectThe integer widths, broadcast against the elements.
fillcharobjectThe one-character fills, broadcast; null is NumPy's default
' '.
Returns
- NDCharArray
A chararray at the widest result width: owning its data for
U, a view of the computed array forS(with aStringDTypefill NumPy's trivial loop does not copy, see center(object, object)).
Exceptions
- ArgumentNullException
widthis null.- TypeError
- ValueError
An empty array; a
StringDTypefill beside a chararray NumPy's trivial loop copies (see center(object, object)).- UnicodeEncodeError
A non-ASCII fill for an
Schararray.- IncorrectShapeException
An argument does not broadcast.
rpartition(object)
NumPy's chararray.rpartition(sep): each element split around the LAST sep into the
part before it, the separator and the part after it (without a match: two empty strings and the element). The
result adds a final axis of length three for the three parts.
public NDCharArray rpartition(object sep)
Parameters
sepobjectThe separator, broadcast against the array's elements: a C# string (NumPy's Python
str), abyte[](Pythonbytes), or an array; it is cast to this array's dtype first (a number is its text).
Returns
- NDCharArray
A chararray holding the three parts of each element on its last axis, at the widest part's width: a VIEW of the stacked parts for bytes, a COPY for str (NumPy's
np.char.asarraycompares a str array's width in characters with its itemsize in bytes and copies).
Remarks
NumPy's chararray.rpartition is asarray(rpartition(self, sep)), numpy.char's
rpartition being np.stack(np.strings.rpartition(a, sep), axis=-1) (a plain array, see
rpartition(object, object)), seen as a chararray by np.char.asarray: the stacked array is
private to the call, so its U form takes it over instead of copying it
(AsArrayOfFresh(NDArray)).
Exceptions
- ArgumentNullException
sepis null.- ValueError
An empty separator (
empty separator); an empty array (zero-size array to reduction operation maximum which has no identity, NumPy's sizing).- TypeError
No loop for the classes.
- UnicodeEncodeError
A non-ASCII separator for a bytes chararray.
- IncorrectShapeException
The separator does not broadcast.
rsplit(object, object)
NumPy's chararray.rsplit(sep=None, maxsplit=None): np.char.rsplit(self, sep, maxsplit), the
elements unstripped.
public NDListArray rsplit(object sep = null, object maxsplit = null)
Parameters
sepobjectThe separator (null for whitespace).
maxsplitobjectThe most splits per element, from the right.
Returns
- NDListArray
A disposable NDListArray representing NumPy's object array of lists; the caller must dispose the holder explicitly, even when array work runs inside an NDScope.
Exceptions
- TypeError
- OverflowException
A maxsplit past
Py_ssize_t.- ValueError
An empty separator.
- SystemError
A one-unit
Uelement, separator or word above U+10FFFF.- IncorrectShapeException
The arguments do not broadcast.
rstrip(object)
NumPy's chararray.rstrip(chars=None): every element without its TRAILING characters found in
chars (whitespace for null), over the stored text: rstrip('x') of a stored
'ax ' keeps 'ax ' (the spaces end it), where its stripped element reads 'ax'.
public NDCharArray rstrip(object chars = null)
Parameters
charsobjectThe characters to remove, as a set, broadcast (see strip(object)); null strips whitespace.
Returns
- NDCharArray
A chararray view of the stripped array, of this array's dtype.
Exceptions
- TypeError
No loop for the classes.
- ValueError
A
StringDTypeset when this chararray is 0-d, or 1-d with at mostnp.getbufsize()elements (NumPy's trivial-loop copy:Can only create a chararray from string data.).- NotSupportedException
A
StringDTypeset beside a larger chararray (NumPy's plainStringDTyperesult;np.char.rstripreturns it).- IncorrectShapeException
charsdoes not broadcast.
split(object, object)
NumPy's chararray.split(sep=None, maxsplit=None): np.char.split(self, sep, maxsplit) — every
element's list of words, read UNSTRIPPED (the elements reach Python's str.split as NumPy scalars, not
through the chararray's stripping element access).
public NDListArray split(object sep = null, object maxsplit = null)
Parameters
sepobjectThe separator (null for whitespace; see split(object, object, object)).
maxsplitobjectThe most splits per element (null or negative for no limit).
Returns
- NDListArray
A disposable NDListArray representing NumPy's object array of lists; the caller must dispose the holder explicitly, even when array work runs inside an NDScope.
Exceptions
- TypeError
- OverflowException
A maxsplit past
Py_ssize_t.- ValueError
An empty separator.
- SystemError
A one-unit
Uelement, separator or word above U+10FFFF.- IncorrectShapeException
The arguments do not broadcast.
splitlines(object)
NumPy's chararray.splitlines(keepends=None): np.char.splitlines(self, keepends), the elements
unstripped (a trailing line boundary is not lost to the chararray's strip).
public NDListArray splitlines(object keepends = null)
Parameters
keependsobjectWhether each line keeps its boundary (Python's truth rule; null is false).
Returns
- NDListArray
A disposable NDListArray representing NumPy's object array of lists; the caller must dispose the holder explicitly, even when array work runs inside an NDScope.
Exceptions
- TypeError
- SystemError
A one-unit
Uelement, keepends value or line above U+10FFFF.- IncorrectShapeException
The arguments do not broadcast.
squeeze(int?)
The chararray without its length-1 axes (NumPy's c.squeeze(axis)).
public NDCharArray squeeze(int? axis = null)
Parameters
axisint?The axis to remove, or
nullfor every axis of length 1.
Returns
- NDCharArray
This chararray ITSELF when
axisisnulland no axis has length 1 (as NumPy); otherwise a chararray view.
Exceptions
- AxisError
axisis out of bounds.- ValueError
axisnames an axis longer than 1, or this chararray holds data that is not string data and an axis is removed (NumPy wraps that plain view as an ndarray; the C# type here is a chararray).
startswith(object, object, object)
NumPy's chararray.startswith(prefix, start=0, end=None): whether every element's [start:end]
range begins with prefix (the stored text, unstripped).
public NDArray startswith(object prefix, object start = null, object end = null)
Parameters
prefixobjectThe prefixes, broadcast against the elements (this array's class).
startobjectThe range starts in slice notation, broadcast; null is NumPy's default 0.
endobjectThe range ends in slice notation, broadcast; null is NumPy's
None.
Returns
- NDArray
A plain bool array of the broadcast shape (0-d for a 0-d chararray).
Exceptions
- ArgumentNullException
prefixis null.- TypeError
No loop for the classes.
- TypeError
A start / end that cannot reach int64 by a same_kind cast.
- OverflowException
A start / end literal past int64.
- IncorrectShapeException
An argument does not broadcast.
strip(object)
NumPy's chararray.strip(chars=None): every element without its leading and trailing characters found in
chars (whitespace for null) — the stored text, so the trailing whitespace element access
hides is stripped too.
public NDCharArray strip(object chars = null)
Parameters
charsobjectThe characters to remove, as a set, broadcast against the elements (this array's class); null strips whitespace (ASCII whitespace for
S, Python'sstr.isspaceforU).
Returns
- NDCharArray
A chararray VIEW of the stripped array, of this array's dtype: NumPy's member returns the function's result, which
chararray.array_wrapmakes a view (it does not own its data).
Remarks
NumPy's member is strip(self, chars); see strip(object, object) for the function. The
member forwards without a scope: the function's chararray rule makes the view NumPy returns, and
it allocates nothing the member must reclaim.
Exceptions
- TypeError
No loop for the classes (a
bytesset for aUchararray, a number).- ValueError
A
StringDTypeset when this chararray is 0-d, or 1-d with at mostnp.getbufsize()elements: NumPy's trivial loop copies it intoStringDType()as a chararray (Can only create a chararray from string data.).- NotSupportedException
A
StringDTypeset beside a larger chararray: NumPy's member then returns the function's PLAINStringDTypearray, which this member's NDCharArray type cannot hold (np.char.stripreturns it).- IncorrectShapeException
charsdoes not broadcast.
swapaxes(int, int)
The chararray with two axes exchanged (NumPy's c.swapaxes(a, b)).
public NDCharArray swapaxes(int axis1, int axis2)
Parameters
Returns
- NDCharArray
A view.
Exceptions
- AxisError
An axis is out of bounds.
- ValueError
This chararray holds data that is not string data.
swapcase()
NumPy's chararray.swapcase(): asarray(swapcase(self)), each element's uppercase characters
lowered and lowercase characters uppercased, over the stored text.
public NDCharArray swapcase()
Returns
- NDCharArray
A chararray of this array's dtype and shape: owning its data for
U, a view of the computed array forS; 0-d for a 0-d chararray.
Remarks
See swapcase(object) for the function.
Exceptions
- SystemError
A
Uelement holding a code unit past U+10FFFF.
take(NDArray, int?, NDCharArray, string)
Elements selected by index along an axis, as a chararray (NumPy's c.take(indices, axis, out, mode)).
Without an axis the chararray is read flat.
public NDCharArray take(NDArray indices, int? axis = null, NDCharArray @out = null, string mode = "raise")
Parameters
indicesNDArrayThe indices: an integer array, or one C# integer (
c.take(1), NumPy's 0-d index, which selects one element).axisint?The axis, or
nullto index the flattened chararray.outNDCharArrayNumPy's
out=: a chararray of the result's shape that receives the elements and is returned, or null. A plain NDArray out binds take(NDArray, int?, NDArray, string) instead and returns that array, as NumPy returns itsoutwhatever its class.modestring"raise","wrap"or"clip"for an index out of bounds.
Returns
- NDCharArray
A new chararray that owns its data (or
out); for a 0-d result the element as a read-only 0-d stand-in, NOT stripped (NumPy'sPyArray_Returngives the element's NumPy scalar, which is notgetitem's stripped value).
Remarks
One overload, NumPy's signature: indices takes NumPy's int or int array_like through
NumSharp's implicit conversions, so the one-index overload this member used to have adds nothing.
Exceptions
- IndexError
An index is out of bounds under
"raise".- AxisError
axisis out of bounds.- ArgumentException
An index array of a non-integer dtype, or an unknown mode.
- ValueError
This chararray holds data that is not string data; NumPy's out= errors (another shape, read-only).
title()
NumPy's chararray.title(): asarray(title(self)), each element in titlecase (a character after
a cased character lowered, any other titlecased), over the stored text.
public NDCharArray title()
Returns
- NDCharArray
A chararray of this array's dtype and shape: owning its data for
U, a view of the computed array forS; 0-d for a 0-d chararray.
Remarks
See title(object) for the function.
Exceptions
- SystemError
A
Uelement holding a code unit past U+10FFFF.
to_device(string, object)
Array-API device transfer: only "cpu" exists, and the chararray itself is returned.
public NDCharArray to_device(string device, object stream = null)
Parameters
Returns
- NDCharArray
This chararray.
Exceptions
- ArgumentNullException
deviceisnull.- ValueError
A stream, then another device: to_device(string, object)'s NumPy texts.
translate(object, object)
NumPy's chararray.translate(table, deletechars=None): asarray(translate(self, table,
deletechars)), every character of each element mapped through table, over the stored
text.
public NDCharArray translate(object table, object deletechars = null)
Parameters
tableobjectThe table (see translate(NDArray, object, object)): a dict keyed by code point for a
Uchararray, a 256-byte table or null for anSone; broadcast against the elements.deletecharsobjectThe bytes to delete (an
Schararray only; NumPy ignores it forU); null passes nothing.
Returns
- NDCharArray
A chararray of this array's dtype over the broadcast shape: owning its data for
U, a view of the computed array forS; 0-d for a 0-d chararray.
Remarks
See translate(object, object, object) for the function.
Exceptions
- TypeError
A table or delete set of the wrong kind (
a bytes-like object is required, not 'dict'forS; a dict value that is not an int, None or str forU).- ValueError
A mapping outside
range(0x110000); anStable that is not 256 bytes long.- SystemError
A
Uunit past U+10FFFF that the call would keep.- IncorrectShapeException
tabledoes not broadcast.- NotSupportedException
A table with no NumSharp form (an object array of lists).
transpose(params int[])
The chararray with its axes permuted (NumPy's c.transpose(*axes)); without an argument the axes
reversed.
public NDCharArray transpose(params int[] axes)
Parameters
axesint[]NumPy's
*axes: the permutation as separate integers (c.transpose(1, 0)) or one array (NumPy's tuple), or none (or null) to reverse the axes.
Returns
- NDCharArray
A view.
Remarks
One member, NumPy's signature (ndarray.transpose takes no keyword). It hides
transpose(int[]), whose parameter is the same array.
Exceptions
- ArgumentException
The permutation does not match the axes.
- AxisError
An axis is out of bounds.
- ValueError
This chararray holds data that is not string data.
upper()
NumPy's chararray.upper(): asarray(upper(self)), each element's text uppercased (CPython's
str.upper for U, a growing mapping cut to the element width; ASCII letters for S), over
the stored text.
public NDCharArray upper()
Returns
- NDCharArray
A chararray of this array's dtype and shape: owning its data for
U, a view of the computed array forS; 0-d for a 0-d chararray.
Remarks
See upper(object) for the function.
Exceptions
- SystemError
A
Uelement holding a code unit past U+10FFFF.
view(DType)
A new chararray object over the same memory (NumPy's c.view()), optionally reading the bytes as another
dtype. NumPy checks the finalize rule against the dtype this chararray HAS and only then changes it, so
c.view(np.uint32) is a uint32 chararray (whose own views and copies raise).
public NDCharArray view(DType dtype = null)
Parameters
dtypeDTypeThe dtype to read the bytes as, or
nullto keep it. A dtype of another size changes the length of the last axis.
Returns
- NDCharArray
A view; writes reach this chararray.
Exceptions
- ValueError
This chararray holds data that is not string data (the rule reads the current dtype), or one of NumPy's itemsize errors.
- TypeError
A view to or from a
StringDTypedescriptor.
view(DType, Type)
NumPy's c.view(dtype, type): a view of this chararray as the array class type,
its bytes read as dtype.
public NDArray view(DType dtype, Type type)
Parameters
dtypeDTypeThe dtype to read the bytes as, or
nullto keep it.typeTypeThe array class (
typeof(NDArray),typeof(NDCharArray),typeof(NDMatrix)), ornullfor this chararray's own class.
Returns
- NDArray
A view of the class asked for.
Exceptions
- ValueError
The finalize rule of the class asked for refuses the dtype this chararray HAS, or
typeis not an array class (Type must be a sub-type of ndarray type).- NotSupportedException
An array class with no NumPy counterpart.
view(Type)
NumPy's c.view(type): a new view of this chararray as the array class type
(typeof(NDArray) for the plain array, typeof(NDCharArray), typeof(NDMatrix)), or — when
type is not an array class — read as the dtype that CLR type names.
public NDArray view(Type type)
Parameters
typeTypeThe array class, or a CLR element type (
typeof(uint)).
Returns
Remarks
Declared here because the chararray's own view(DType) would otherwise take a Type argument through its implicit conversion to DType.
Exceptions
- ValueError
The finalize rule of the class asked for refuses this chararray's dtype, or a CLR type that is neither an array class nor a dtype.
- NotSupportedException
An array class with no NumPy counterpart (
NDArray<T>).
zfill(object)
NumPy's chararray.zfill(width): every element left-filled with '0' to width
characters, a leading '+' / '-' moved in front of the zeros.
public NDCharArray zfill(object width)
Parameters
widthobjectThe integer widths, broadcast against the elements.
Returns
- NDCharArray
A chararray at the widest result width: owning its data for
U, a view of the computed array forS.
Exceptions
- ArgumentNullException
widthis null.- TypeError
A
widththat is not an integer array (unsupported type <U1 for operand 'width'); a uint64 width.- ValueError
An empty array.
- IncorrectShapeException
widthdoes not broadcast.
Operators
operator +(NDArray, NDCharArray)
NumPy's chararray.add / radd: element-wise concatenation in the written order
(np.add), the result a chararray view of the computed array (c + "x" keeps trailing whitespace
inside the stored text: only element access strips).
public static NDCharArray operator +(NDArray left, NDCharArray right)
Parameters
leftNDArrayThe left operand.
rightNDCharArrayThe right operand.
Returns
- NDCharArray
The concatenation as a chararray.
Remarks
Python's dispatch: the chararray's add / radd answers whichever side it is on, an
element stand-in (NumPy's str / bytes) is no chararray, and the static rule applies — an
NDArray-typed reference to a chararray binds NDArray's +, plain.
Exceptions
- TypeError
A bytes / str mix or a number operand (NumPy's ufunc texts); the C#
null(NumPy'sNone) beside a chararray NumPy does not copy: CPython's concatenation error.- ValueError
A
StringDTypeornulloperand beside a 0-d or short 1-d chararray (the finalize error of NumPy's trivial-loop copy).- NotSupportedException
A
StringDTypeoperand beside a larger chararray: NumPy returns a plain StringDType array, which an NDCharArray cannot hold (callnp.add).- IncorrectShapeException
The operands do not broadcast.
operator +(NDCharArray, NDArray)
NumPy's chararray.add / radd: element-wise concatenation in the written order
(np.add), the result a chararray view of the computed array (c + "x" keeps trailing whitespace
inside the stored text: only element access strips).
public static NDCharArray operator +(NDCharArray left, NDArray right)
Parameters
leftNDCharArrayThe left operand.
rightNDArrayThe right operand.
Returns
- NDCharArray
The concatenation as a chararray.
Remarks
Python's dispatch: the chararray's add / radd answers whichever side it is on, an
element stand-in (NumPy's str / bytes) is no chararray, and the static rule applies — an
NDArray-typed reference to a chararray binds NDArray's +, plain.
Exceptions
- TypeError
A bytes / str mix or a number operand (NumPy's ufunc texts); the C#
null(NumPy'sNone) beside a chararray NumPy does not copy: CPython's concatenation error.- ValueError
A
StringDTypeornulloperand beside a 0-d or short 1-d chararray (the finalize error of NumPy's trivial-loop copy).- NotSupportedException
A
StringDTypeoperand beside a larger chararray: NumPy returns a plain StringDType array, which an NDCharArray cannot hold (callnp.add).- IncorrectShapeException
The operands do not broadcast.
operator +(NDCharArray, NDCharArray)
NumPy's chararray.add / radd: element-wise concatenation in the written order
(np.add), the result a chararray view of the computed array (c + "x" keeps trailing whitespace
inside the stored text: only element access strips).
public static NDCharArray operator +(NDCharArray left, NDCharArray right)
Parameters
leftNDCharArrayThe left operand.
rightNDCharArrayThe right operand.
Returns
- NDCharArray
The concatenation as a chararray.
Remarks
Python's dispatch: the chararray's add / radd answers whichever side it is on, an
element stand-in (NumPy's str / bytes) is no chararray, and the static rule applies — an
NDArray-typed reference to a chararray binds NDArray's +, plain.
Exceptions
- TypeError
A bytes / str mix or a number operand (NumPy's ufunc texts); the C#
null(NumPy'sNone) beside a chararray NumPy does not copy: CPython's concatenation error.- ValueError
A
StringDTypeornulloperand beside a 0-d or short 1-d chararray (the finalize error of NumPy's trivial-loop copy).- NotSupportedException
A
StringDTypeoperand beside a larger chararray: NumPy returns a plain StringDType array, which an NDCharArray cannot hold (callnp.add).- IncorrectShapeException
The operands do not broadcast.
operator +(NDCharArray, object)
NumPy's chararray.add / radd: element-wise concatenation in the written order
(np.add), the result a chararray view of the computed array (c + "x" keeps trailing whitespace
inside the stored text: only element access strips).
public static NDCharArray operator +(NDCharArray left, object right)
Parameters
leftNDCharArrayThe left operand.
rightobjectThe right operand.
Returns
- NDCharArray
The concatenation as a chararray.
Remarks
Python's dispatch: the chararray's add / radd answers whichever side it is on, an
element stand-in (NumPy's str / bytes) is no chararray, and the static rule applies — an
NDArray-typed reference to a chararray binds NDArray's +, plain.
Exceptions
- TypeError
A bytes / str mix or a number operand (NumPy's ufunc texts); the C#
null(NumPy'sNone) beside a chararray NumPy does not copy: CPython's concatenation error.- ValueError
A
StringDTypeornulloperand beside a 0-d or short 1-d chararray (the finalize error of NumPy's trivial-loop copy).- NotSupportedException
A
StringDTypeoperand beside a larger chararray: NumPy returns a plain StringDType array, which an NDCharArray cannot hold (callnp.add).- IncorrectShapeException
The operands do not broadcast.
operator +(NDCharArray, string)
NumPy's chararray.add / radd: element-wise concatenation in the written order
(np.add), the result a chararray view of the computed array (c + "x" keeps trailing whitespace
inside the stored text: only element access strips).
public static NDCharArray operator +(NDCharArray left, string right)
Parameters
leftNDCharArrayThe left operand.
rightstringThe right operand.
Returns
- NDCharArray
The concatenation as a chararray.
Remarks
Python's dispatch: the chararray's add / radd answers whichever side it is on, an
element stand-in (NumPy's str / bytes) is no chararray, and the static rule applies — an
NDArray-typed reference to a chararray binds NDArray's +, plain.
Exceptions
- TypeError
A bytes / str mix or a number operand (NumPy's ufunc texts); the C#
null(NumPy'sNone) beside a chararray NumPy does not copy: CPython's concatenation error.- ValueError
A
StringDTypeornulloperand beside a 0-d or short 1-d chararray (the finalize error of NumPy's trivial-loop copy).- NotSupportedException
A
StringDTypeoperand beside a larger chararray: NumPy returns a plain StringDType array, which an NDCharArray cannot hold (callnp.add).- IncorrectShapeException
The operands do not broadcast.
operator +(object, NDCharArray)
NumPy's chararray.add / radd: element-wise concatenation in the written order
(np.add), the result a chararray view of the computed array (c + "x" keeps trailing whitespace
inside the stored text: only element access strips).
public static NDCharArray operator +(object left, NDCharArray right)
Parameters
leftobjectThe left operand.
rightNDCharArrayThe right operand.
Returns
- NDCharArray
The concatenation as a chararray.
Remarks
Python's dispatch: the chararray's add / radd answers whichever side it is on, an
element stand-in (NumPy's str / bytes) is no chararray, and the static rule applies — an
NDArray-typed reference to a chararray binds NDArray's +, plain.
Exceptions
- TypeError
A bytes / str mix or a number operand (NumPy's ufunc texts); the C#
null(NumPy'sNone) beside a chararray NumPy does not copy: CPython's concatenation error.- ValueError
A
StringDTypeornulloperand beside a 0-d or short 1-d chararray (the finalize error of NumPy's trivial-loop copy).- NotSupportedException
A
StringDTypeoperand beside a larger chararray: NumPy returns a plain StringDType array, which an NDCharArray cannot hold (callnp.add).- IncorrectShapeException
The operands do not broadcast.
operator +(string, NDCharArray)
NumPy's chararray.add / radd: element-wise concatenation in the written order
(np.add), the result a chararray view of the computed array (c + "x" keeps trailing whitespace
inside the stored text: only element access strips).
public static NDCharArray operator +(string left, NDCharArray right)
Parameters
leftstringThe left operand.
rightNDCharArrayThe right operand.
Returns
- NDCharArray
The concatenation as a chararray.
Remarks
Python's dispatch: the chararray's add / radd answers whichever side it is on, an
element stand-in (NumPy's str / bytes) is no chararray, and the static rule applies — an
NDArray-typed reference to a chararray binds NDArray's +, plain.
Exceptions
- TypeError
A bytes / str mix or a number operand (NumPy's ufunc texts); the C#
null(NumPy'sNone) beside a chararray NumPy does not copy: CPython's concatenation error.- ValueError
A
StringDTypeornulloperand beside a 0-d or short 1-d chararray (the finalize error of NumPy's trivial-loop copy).- NotSupportedException
A
StringDTypeoperand beside a larger chararray: NumPy returns a plain StringDType array, which an NDCharArray cannot hold (callnp.add).- IncorrectShapeException
The operands do not broadcast.
operator ==(NDArray, NDCharArray)
NumPy's chararray.eq: np.char.equal(left, right), element-wise equality once each element
has lost its trailing NULs and ASCII whitespace ('a ' equals 'a'), after Python's dispatch
(see the class's operator notes: a plain array on the other side still strips).
public static NDArray<bool> operator ==(NDArray left, NDCharArray right)
Parameters
leftNDArrayThe left operand.
rightNDCharArrayThe right operand.
Returns
- NDArray<bool>
The bool array of the broadcast shape; a 0-d
Falsewhen anSchararray meetsUtext with nothing to compare them (Python's fallback).
Exceptions
- TypeError
A non-text operand:
comparison of non-string arrays.- IncorrectShapeException
The operands do not broadcast.
operator ==(NDCharArray, NDArray)
NumPy's chararray.eq: np.char.equal(left, right), element-wise equality once each element
has lost its trailing NULs and ASCII whitespace ('a ' equals 'a'), after Python's dispatch
(see the class's operator notes: a plain array on the other side still strips).
public static NDArray<bool> operator ==(NDCharArray left, NDArray right)
Parameters
leftNDCharArrayThe left operand.
rightNDArrayThe right operand.
Returns
- NDArray<bool>
The bool array of the broadcast shape; a 0-d
Falsewhen anSchararray meetsUtext with nothing to compare them (Python's fallback).
Exceptions
- TypeError
A non-text operand:
comparison of non-string arrays.- IncorrectShapeException
The operands do not broadcast.
operator ==(NDCharArray, NDCharArray)
NumPy's chararray.eq: np.char.equal(left, right), element-wise equality once each element
has lost its trailing NULs and ASCII whitespace ('a ' equals 'a'), after Python's dispatch
(see the class's operator notes: a plain array on the other side still strips).
public static NDArray<bool> operator ==(NDCharArray left, NDCharArray right)
Parameters
leftNDCharArrayThe left operand.
rightNDCharArrayThe right operand.
Returns
- NDArray<bool>
The bool array of the broadcast shape; a 0-d
Falsewhen anSchararray meetsUtext with nothing to compare them (Python's fallback).
Exceptions
- TypeError
A non-text operand:
comparison of non-string arrays.- IncorrectShapeException
The operands do not broadcast.
operator ==(NDCharArray, object)
NumPy's chararray.eq: np.char.equal(left, right), element-wise equality once each element
has lost its trailing NULs and ASCII whitespace ('a ' equals 'a'), after Python's dispatch
(see the class's operator notes: a plain array on the other side still strips).
public static NDArray<bool> operator ==(NDCharArray left, object right)
Parameters
leftNDCharArrayThe left operand.
rightobjectThe right operand.
Returns
- NDArray<bool>
The bool array of the broadcast shape; a 0-d
Falsewhen anSchararray meetsUtext with nothing to compare them (Python's fallback).
Exceptions
- TypeError
A non-text operand:
comparison of non-string arrays.- IncorrectShapeException
The operands do not broadcast.
operator ==(NDCharArray, string)
NumPy's chararray.eq: np.char.equal(left, right), element-wise equality once each element
has lost its trailing NULs and ASCII whitespace ('a ' equals 'a'), after Python's dispatch
(see the class's operator notes: a plain array on the other side still strips).
public static NDArray<bool> operator ==(NDCharArray left, string right)
Parameters
leftNDCharArrayThe left operand.
rightstringThe right operand.
Returns
- NDArray<bool>
The bool array of the broadcast shape; a 0-d
Falsewhen anSchararray meetsUtext with nothing to compare them (Python's fallback).
Exceptions
- TypeError
A non-text operand:
comparison of non-string arrays.- IncorrectShapeException
The operands do not broadcast.
operator ==(object, NDCharArray)
NumPy's chararray.eq: np.char.equal(left, right), element-wise equality once each element
has lost its trailing NULs and ASCII whitespace ('a ' equals 'a'), after Python's dispatch
(see the class's operator notes: a plain array on the other side still strips).
public static NDArray<bool> operator ==(object left, NDCharArray right)
Parameters
leftobjectThe left operand.
rightNDCharArrayThe right operand.
Returns
- NDArray<bool>
The bool array of the broadcast shape; a 0-d
Falsewhen anSchararray meetsUtext with nothing to compare them (Python's fallback).
Exceptions
- TypeError
A non-text operand:
comparison of non-string arrays.- IncorrectShapeException
The operands do not broadcast.
operator ==(string, NDCharArray)
NumPy's chararray.eq: np.char.equal(left, right), element-wise equality once each element
has lost its trailing NULs and ASCII whitespace ('a ' equals 'a'), after Python's dispatch
(see the class's operator notes: a plain array on the other side still strips).
public static NDArray<bool> operator ==(string left, NDCharArray right)
Parameters
leftstringThe left operand.
rightNDCharArrayThe right operand.
Returns
- NDArray<bool>
The bool array of the broadcast shape; a 0-d
Falsewhen anSchararray meetsUtext with nothing to compare them (Python's fallback).
Exceptions
- TypeError
A non-text operand:
comparison of non-string arrays.- IncorrectShapeException
The operands do not broadcast.
operator >(NDArray, NDCharArray)
NumPy's chararray.gt: np.char.greater(left, right) after stripping, with Python's dispatch.
public static NDArray<bool> operator >(NDArray left, NDCharArray right)
Parameters
leftNDArrayThe left operand.
rightNDCharArrayThe right operand.
Returns
Exceptions
- TypeError
A non-text operand, or an
S/Umix nothing compares.- IncorrectShapeException
The operands do not broadcast.
operator >(NDCharArray, NDArray)
NumPy's chararray.gt: np.char.greater(left, right) after stripping, with Python's dispatch.
public static NDArray<bool> operator >(NDCharArray left, NDArray right)
Parameters
leftNDCharArrayThe left operand.
rightNDArrayThe right operand.
Returns
Exceptions
- TypeError
A non-text operand, or an
S/Umix nothing compares.- IncorrectShapeException
The operands do not broadcast.
operator >(NDCharArray, NDCharArray)
NumPy's chararray.gt: np.char.greater(left, right) after stripping, with Python's dispatch.
public static NDArray<bool> operator >(NDCharArray left, NDCharArray right)
Parameters
leftNDCharArrayThe left operand.
rightNDCharArrayThe right operand.
Returns
Exceptions
- TypeError
A non-text operand, or an
S/Umix nothing compares.- IncorrectShapeException
The operands do not broadcast.
operator >(NDCharArray, object)
NumPy's chararray.gt: np.char.greater(left, right) after stripping, with Python's dispatch.
public static NDArray<bool> operator >(NDCharArray left, object right)
Parameters
leftNDCharArrayThe left operand.
rightobjectThe right operand.
Returns
Exceptions
- TypeError
A non-text operand, or an
S/Umix nothing compares.- IncorrectShapeException
The operands do not broadcast.
operator >(NDCharArray, string)
NumPy's chararray.gt: np.char.greater(left, right) after stripping, with Python's dispatch.
public static NDArray<bool> operator >(NDCharArray left, string right)
Parameters
leftNDCharArrayThe left operand.
rightstringThe right operand.
Returns
Exceptions
- TypeError
A non-text operand, or an
S/Umix nothing compares.- IncorrectShapeException
The operands do not broadcast.
operator >(object, NDCharArray)
NumPy's chararray.gt: np.char.greater(left, right) after stripping, with Python's dispatch.
public static NDArray<bool> operator >(object left, NDCharArray right)
Parameters
leftobjectThe left operand.
rightNDCharArrayThe right operand.
Returns
Exceptions
- TypeError
A non-text operand, or an
S/Umix nothing compares.- IncorrectShapeException
The operands do not broadcast.
operator >(string, NDCharArray)
NumPy's chararray.gt: np.char.greater(left, right) after stripping, with Python's dispatch.
public static NDArray<bool> operator >(string left, NDCharArray right)
Parameters
leftstringThe left operand.
rightNDCharArrayThe right operand.
Returns
Exceptions
- TypeError
A non-text operand, or an
S/Umix nothing compares.- IncorrectShapeException
The operands do not broadcast.
operator >=(NDArray, NDCharArray)
NumPy's chararray.ge: np.char.greater_equal(left, right) after stripping, with Python's
dispatch.
public static NDArray<bool> operator >=(NDArray left, NDCharArray right)
Parameters
leftNDArrayThe left operand.
rightNDCharArrayThe right operand.
Returns
Exceptions
- TypeError
A non-text operand, or an
S/Umix nothing compares.- IncorrectShapeException
The operands do not broadcast.
operator >=(NDCharArray, NDArray)
NumPy's chararray.ge: np.char.greater_equal(left, right) after stripping, with Python's
dispatch.
public static NDArray<bool> operator >=(NDCharArray left, NDArray right)
Parameters
leftNDCharArrayThe left operand.
rightNDArrayThe right operand.
Returns
Exceptions
- TypeError
A non-text operand, or an
S/Umix nothing compares.- IncorrectShapeException
The operands do not broadcast.
operator >=(NDCharArray, NDCharArray)
NumPy's chararray.ge: np.char.greater_equal(left, right) after stripping, with Python's
dispatch.
public static NDArray<bool> operator >=(NDCharArray left, NDCharArray right)
Parameters
leftNDCharArrayThe left operand.
rightNDCharArrayThe right operand.
Returns
Exceptions
- TypeError
A non-text operand, or an
S/Umix nothing compares.- IncorrectShapeException
The operands do not broadcast.
operator >=(NDCharArray, object)
NumPy's chararray.ge: np.char.greater_equal(left, right) after stripping, with Python's
dispatch.
public static NDArray<bool> operator >=(NDCharArray left, object right)
Parameters
leftNDCharArrayThe left operand.
rightobjectThe right operand.
Returns
Exceptions
- TypeError
A non-text operand, or an
S/Umix nothing compares.- IncorrectShapeException
The operands do not broadcast.
operator >=(NDCharArray, string)
NumPy's chararray.ge: np.char.greater_equal(left, right) after stripping, with Python's
dispatch.
public static NDArray<bool> operator >=(NDCharArray left, string right)
Parameters
leftNDCharArrayThe left operand.
rightstringThe right operand.
Returns
Exceptions
- TypeError
A non-text operand, or an
S/Umix nothing compares.- IncorrectShapeException
The operands do not broadcast.
operator >=(object, NDCharArray)
NumPy's chararray.ge: np.char.greater_equal(left, right) after stripping, with Python's
dispatch.
public static NDArray<bool> operator >=(object left, NDCharArray right)
Parameters
leftobjectThe left operand.
rightNDCharArrayThe right operand.
Returns
Exceptions
- TypeError
A non-text operand, or an
S/Umix nothing compares.- IncorrectShapeException
The operands do not broadcast.
operator >=(string, NDCharArray)
NumPy's chararray.ge: np.char.greater_equal(left, right) after stripping, with Python's
dispatch.
public static NDArray<bool> operator >=(string left, NDCharArray right)
Parameters
leftstringThe left operand.
rightNDCharArrayThe right operand.
Returns
Exceptions
- TypeError
A non-text operand, or an
S/Umix nothing compares.- IncorrectShapeException
The operands do not broadcast.
implicit operator NDCharArray(byte[])
A C# byte[] as the Python bytes it stands for: a read-only 0-d S stand-in holding the
bytes as they are. It lets c[0] = bytes compile against the chararray indexers.
public static implicit operator NDCharArray(byte[] value)
Parameters
valuebyte[]The bytes.
Returns
- NDCharArray
The 0-d stand-in.
Exceptions
- ArgumentNullException
valueisnull.
implicit operator NDCharArray(string)
A C# string as the Python str it stands for: a read-only 0-d U stand-in holding the text as it is
(no stripping; NumPy's np.array(str) width, at least one character). It lets
c[0] = "text" compile against the chararray indexers, whose value type is NDCharArray.
public static implicit operator NDCharArray(string value)
Parameters
valuestringThe text.
Returns
- NDCharArray
The 0-d stand-in.
Exceptions
- ArgumentNullException
valueisnull.
operator !=(NDArray, NDCharArray)
NumPy's chararray.ne: np.char.not_equal(left, right) after stripping, with Python's dispatch.
public static NDArray<bool> operator !=(NDArray left, NDCharArray right)
Parameters
leftNDArrayThe left operand.
rightNDCharArrayThe right operand.
Returns
Exceptions
- TypeError
A non-text operand:
comparison of non-string arrays.- IncorrectShapeException
The operands do not broadcast.
operator !=(NDCharArray, NDArray)
NumPy's chararray.ne: np.char.not_equal(left, right) after stripping, with Python's dispatch.
public static NDArray<bool> operator !=(NDCharArray left, NDArray right)
Parameters
leftNDCharArrayThe left operand.
rightNDArrayThe right operand.
Returns
Exceptions
- TypeError
A non-text operand:
comparison of non-string arrays.- IncorrectShapeException
The operands do not broadcast.
operator !=(NDCharArray, NDCharArray)
NumPy's chararray.ne: np.char.not_equal(left, right) after stripping, with Python's dispatch.
public static NDArray<bool> operator !=(NDCharArray left, NDCharArray right)
Parameters
leftNDCharArrayThe left operand.
rightNDCharArrayThe right operand.
Returns
Exceptions
- TypeError
A non-text operand:
comparison of non-string arrays.- IncorrectShapeException
The operands do not broadcast.
operator !=(NDCharArray, object)
NumPy's chararray.ne: np.char.not_equal(left, right) after stripping, with Python's dispatch.
public static NDArray<bool> operator !=(NDCharArray left, object right)
Parameters
leftNDCharArrayThe left operand.
rightobjectThe right operand.
Returns
Exceptions
- TypeError
A non-text operand:
comparison of non-string arrays.- IncorrectShapeException
The operands do not broadcast.
operator !=(NDCharArray, string)
NumPy's chararray.ne: np.char.not_equal(left, right) after stripping, with Python's dispatch.
public static NDArray<bool> operator !=(NDCharArray left, string right)
Parameters
leftNDCharArrayThe left operand.
rightstringThe right operand.
Returns
Exceptions
- TypeError
A non-text operand:
comparison of non-string arrays.- IncorrectShapeException
The operands do not broadcast.
operator !=(object, NDCharArray)
NumPy's chararray.ne: np.char.not_equal(left, right) after stripping, with Python's dispatch.
public static NDArray<bool> operator !=(object left, NDCharArray right)
Parameters
leftobjectThe left operand.
rightNDCharArrayThe right operand.
Returns
Exceptions
- TypeError
A non-text operand:
comparison of non-string arrays.- IncorrectShapeException
The operands do not broadcast.
operator !=(string, NDCharArray)
NumPy's chararray.ne: np.char.not_equal(left, right) after stripping, with Python's dispatch.
public static NDArray<bool> operator !=(string left, NDCharArray right)
Parameters
leftstringThe left operand.
rightNDCharArrayThe right operand.
Returns
Exceptions
- TypeError
A non-text operand:
comparison of non-string arrays.- IncorrectShapeException
The operands do not broadcast.
operator <(NDArray, NDCharArray)
NumPy's chararray.lt: np.char.less(left, right) after stripping, with Python's dispatch (a
chararray on the right computes its reflected gt).
public static NDArray<bool> operator <(NDArray left, NDCharArray right)
Parameters
leftNDArrayThe left operand.
rightNDCharArrayThe right operand.
Returns
Exceptions
- TypeError
A non-text operand (
comparison of non-string arrays); anS/Umix ('<' not supported between instances of ..., or a plain array's ufunc no-loop text).- IncorrectShapeException
The operands do not broadcast.
operator <(NDCharArray, NDArray)
NumPy's chararray.lt: np.char.less(left, right) after stripping, with Python's dispatch (a
chararray on the right computes its reflected gt).
public static NDArray<bool> operator <(NDCharArray left, NDArray right)
Parameters
leftNDCharArrayThe left operand.
rightNDArrayThe right operand.
Returns
Exceptions
- TypeError
A non-text operand (
comparison of non-string arrays); anS/Umix ('<' not supported between instances of ..., or a plain array's ufunc no-loop text).- IncorrectShapeException
The operands do not broadcast.
operator <(NDCharArray, NDCharArray)
NumPy's chararray.lt: np.char.less(left, right) after stripping, with Python's dispatch (a
chararray on the right computes its reflected gt).
public static NDArray<bool> operator <(NDCharArray left, NDCharArray right)
Parameters
leftNDCharArrayThe left operand.
rightNDCharArrayThe right operand.
Returns
Exceptions
- TypeError
A non-text operand (
comparison of non-string arrays); anS/Umix ('<' not supported between instances of ..., or a plain array's ufunc no-loop text).- IncorrectShapeException
The operands do not broadcast.
operator <(NDCharArray, object)
NumPy's chararray.lt: np.char.less(left, right) after stripping, with Python's dispatch (a
chararray on the right computes its reflected gt).
public static NDArray<bool> operator <(NDCharArray left, object right)
Parameters
leftNDCharArrayThe left operand.
rightobjectThe right operand.
Returns
Exceptions
- TypeError
A non-text operand (
comparison of non-string arrays); anS/Umix ('<' not supported between instances of ..., or a plain array's ufunc no-loop text).- IncorrectShapeException
The operands do not broadcast.
operator <(NDCharArray, string)
NumPy's chararray.lt: np.char.less(left, right) after stripping, with Python's dispatch (a
chararray on the right computes its reflected gt).
public static NDArray<bool> operator <(NDCharArray left, string right)
Parameters
leftNDCharArrayThe left operand.
rightstringThe right operand.
Returns
Exceptions
- TypeError
A non-text operand (
comparison of non-string arrays); anS/Umix ('<' not supported between instances of ..., or a plain array's ufunc no-loop text).- IncorrectShapeException
The operands do not broadcast.
operator <(object, NDCharArray)
NumPy's chararray.lt: np.char.less(left, right) after stripping, with Python's dispatch (a
chararray on the right computes its reflected gt).
public static NDArray<bool> operator <(object left, NDCharArray right)
Parameters
leftobjectThe left operand.
rightNDCharArrayThe right operand.
Returns
Exceptions
- TypeError
A non-text operand (
comparison of non-string arrays); anS/Umix ('<' not supported between instances of ..., or a plain array's ufunc no-loop text).- IncorrectShapeException
The operands do not broadcast.
operator <(string, NDCharArray)
NumPy's chararray.lt: np.char.less(left, right) after stripping, with Python's dispatch (a
chararray on the right computes its reflected gt).
public static NDArray<bool> operator <(string left, NDCharArray right)
Parameters
leftstringThe left operand.
rightNDCharArrayThe right operand.
Returns
Exceptions
- TypeError
A non-text operand (
comparison of non-string arrays); anS/Umix ('<' not supported between instances of ..., or a plain array's ufunc no-loop text).- IncorrectShapeException
The operands do not broadcast.
operator <=(NDArray, NDCharArray)
NumPy's chararray.le: np.char.less_equal(left, right) after stripping, with Python's dispatch.
public static NDArray<bool> operator <=(NDArray left, NDCharArray right)
Parameters
leftNDArrayThe left operand.
rightNDCharArrayThe right operand.
Returns
Exceptions
- TypeError
A non-text operand, or an
S/Umix nothing compares.- IncorrectShapeException
The operands do not broadcast.
operator <=(NDCharArray, NDArray)
NumPy's chararray.le: np.char.less_equal(left, right) after stripping, with Python's dispatch.
public static NDArray<bool> operator <=(NDCharArray left, NDArray right)
Parameters
leftNDCharArrayThe left operand.
rightNDArrayThe right operand.
Returns
Exceptions
- TypeError
A non-text operand, or an
S/Umix nothing compares.- IncorrectShapeException
The operands do not broadcast.
operator <=(NDCharArray, NDCharArray)
NumPy's chararray.le: np.char.less_equal(left, right) after stripping, with Python's dispatch.
public static NDArray<bool> operator <=(NDCharArray left, NDCharArray right)
Parameters
leftNDCharArrayThe left operand.
rightNDCharArrayThe right operand.
Returns
Exceptions
- TypeError
A non-text operand, or an
S/Umix nothing compares.- IncorrectShapeException
The operands do not broadcast.
operator <=(NDCharArray, object)
NumPy's chararray.le: np.char.less_equal(left, right) after stripping, with Python's dispatch.
public static NDArray<bool> operator <=(NDCharArray left, object right)
Parameters
leftNDCharArrayThe left operand.
rightobjectThe right operand.
Returns
Exceptions
- TypeError
A non-text operand, or an
S/Umix nothing compares.- IncorrectShapeException
The operands do not broadcast.
operator <=(NDCharArray, string)
NumPy's chararray.le: np.char.less_equal(left, right) after stripping, with Python's dispatch.
public static NDArray<bool> operator <=(NDCharArray left, string right)
Parameters
leftNDCharArrayThe left operand.
rightstringThe right operand.
Returns
Exceptions
- TypeError
A non-text operand, or an
S/Umix nothing compares.- IncorrectShapeException
The operands do not broadcast.
operator <=(object, NDCharArray)
NumPy's chararray.le: np.char.less_equal(left, right) after stripping, with Python's dispatch.
public static NDArray<bool> operator <=(object left, NDCharArray right)
Parameters
leftobjectThe left operand.
rightNDCharArrayThe right operand.
Returns
Exceptions
- TypeError
A non-text operand, or an
S/Umix nothing compares.- IncorrectShapeException
The operands do not broadcast.
operator <=(string, NDCharArray)
NumPy's chararray.le: np.char.less_equal(left, right) after stripping, with Python's dispatch.
public static NDArray<bool> operator <=(string left, NDCharArray right)
Parameters
leftstringThe left operand.
rightNDCharArrayThe right operand.
Returns
Exceptions
- TypeError
A non-text operand, or an
S/Umix nothing compares.- IncorrectShapeException
The operands do not broadcast.
operator %(NDArray, NDCharArray)
NumPy's chararray.mod: every element of the left chararray formatted with CPython's % against
the broadcast element of the right operand (np.char.asarray(np.char.mod(self, values))); with the
chararray on the RIGHT, the left operand's own % (chararray.rmod is NotImplemented).
public static NDCharArray operator %(NDArray left, NDCharArray right)
Parameters
leftNDArrayThe left operand.
rightNDCharArrayThe right operand.
Returns
- NDCharArray
A chararray on the left: the formatted chararray — an owning copy for
U, a view of the computed array forS— over the broadcast shape (np.@char.array(new[] { "%d", "%x" }) % 255is['255', 'ff']). A C# string, abyte[]or an element stand-in on the left: Python'sstr/bytesformatting with the right operand as its ONE argument, the result a read-only 0-d stand-in ("%s" % cisstr(c),"['a' 'b']";c[0] % 5formats the element's text).
Remarks
Python's dispatch: the chararray's mod answers when it is on the left; on the right only a str /
bytes (which formats any object) or an ndarray (np.remainder, which raises) has a % for it. The
static rule applies, as for +: an NDArray-typed reference to a chararray binds
NDArray's % (np.remainder).
Exceptions
- TypeError
The formatting's errors (the argument count, a conversion the value refuses:
%d format: a real number is required, not numpy.str_); an ndarray or a NumPy scalar on the left of a chararray:np.remainder's no-loop text; any other left operand:unsupported operand type(s) for %: 'int' and 'chararray'.- ValueError
A malformed format (
incomplete format); a NaN under an integer conversion;int()/float()of text that spells no number.- OverflowException
An infinity under an integer conversion; a
%cargument out of range.- IndexError
A
%(key)lookup on a NumPy scalar or an ndarray.- KeyError
A
%(key)missing from a dict.- IncorrectShapeException
The values do not broadcast against the chararray.
operator %(NDCharArray, NDArray)
NumPy's chararray.mod: every element of the left chararray formatted with CPython's % against
the broadcast element of the right operand (np.char.asarray(np.char.mod(self, values))); with the
chararray on the RIGHT, the left operand's own % (chararray.rmod is NotImplemented).
public static NDCharArray operator %(NDCharArray left, NDArray right)
Parameters
leftNDCharArrayThe left operand.
rightNDArrayThe right operand.
Returns
- NDCharArray
A chararray on the left: the formatted chararray — an owning copy for
U, a view of the computed array forS— over the broadcast shape (np.@char.array(new[] { "%d", "%x" }) % 255is['255', 'ff']). A C# string, abyte[]or an element stand-in on the left: Python'sstr/bytesformatting with the right operand as its ONE argument, the result a read-only 0-d stand-in ("%s" % cisstr(c),"['a' 'b']";c[0] % 5formats the element's text).
Remarks
Python's dispatch: the chararray's mod answers when it is on the left; on the right only a str /
bytes (which formats any object) or an ndarray (np.remainder, which raises) has a % for it. The
static rule applies, as for +: an NDArray-typed reference to a chararray binds
NDArray's % (np.remainder).
Exceptions
- TypeError
The formatting's errors (the argument count, a conversion the value refuses:
%d format: a real number is required, not numpy.str_); an ndarray or a NumPy scalar on the left of a chararray:np.remainder's no-loop text; any other left operand:unsupported operand type(s) for %: 'int' and 'chararray'.- ValueError
A malformed format (
incomplete format); a NaN under an integer conversion;int()/float()of text that spells no number.- OverflowException
An infinity under an integer conversion; a
%cargument out of range.- IndexError
A
%(key)lookup on a NumPy scalar or an ndarray.- KeyError
A
%(key)missing from a dict.- IncorrectShapeException
The values do not broadcast against the chararray.
operator %(NDCharArray, NDCharArray)
NumPy's chararray.mod: every element of the left chararray formatted with CPython's % against
the broadcast element of the right operand (np.char.asarray(np.char.mod(self, values))); with the
chararray on the RIGHT, the left operand's own % (chararray.rmod is NotImplemented).
public static NDCharArray operator %(NDCharArray left, NDCharArray right)
Parameters
leftNDCharArrayThe left operand.
rightNDCharArrayThe right operand.
Returns
- NDCharArray
A chararray on the left: the formatted chararray — an owning copy for
U, a view of the computed array forS— over the broadcast shape (np.@char.array(new[] { "%d", "%x" }) % 255is['255', 'ff']). A C# string, abyte[]or an element stand-in on the left: Python'sstr/bytesformatting with the right operand as its ONE argument, the result a read-only 0-d stand-in ("%s" % cisstr(c),"['a' 'b']";c[0] % 5formats the element's text).
Remarks
Python's dispatch: the chararray's mod answers when it is on the left; on the right only a str /
bytes (which formats any object) or an ndarray (np.remainder, which raises) has a % for it. The
static rule applies, as for +: an NDArray-typed reference to a chararray binds
NDArray's % (np.remainder).
Exceptions
- TypeError
The formatting's errors (the argument count, a conversion the value refuses:
%d format: a real number is required, not numpy.str_); an ndarray or a NumPy scalar on the left of a chararray:np.remainder's no-loop text; any other left operand:unsupported operand type(s) for %: 'int' and 'chararray'.- ValueError
A malformed format (
incomplete format); a NaN under an integer conversion;int()/float()of text that spells no number.- OverflowException
An infinity under an integer conversion; a
%cargument out of range.- IndexError
A
%(key)lookup on a NumPy scalar or an ndarray.- KeyError
A
%(key)missing from a dict.- IncorrectShapeException
The values do not broadcast against the chararray.
operator %(NDCharArray, object)
NumPy's chararray.mod: every element of the left chararray formatted with CPython's % against
the broadcast element of the right operand (np.char.asarray(np.char.mod(self, values))); with the
chararray on the RIGHT, the left operand's own % (chararray.rmod is NotImplemented).
public static NDCharArray operator %(NDCharArray left, object right)
Parameters
leftNDCharArrayThe left operand.
rightobjectThe right operand.
Returns
- NDCharArray
A chararray on the left: the formatted chararray — an owning copy for
U, a view of the computed array forS— over the broadcast shape (np.@char.array(new[] { "%d", "%x" }) % 255is['255', 'ff']). A C# string, abyte[]or an element stand-in on the left: Python'sstr/bytesformatting with the right operand as its ONE argument, the result a read-only 0-d stand-in ("%s" % cisstr(c),"['a' 'b']";c[0] % 5formats the element's text).
Remarks
Python's dispatch: the chararray's mod answers when it is on the left; on the right only a str /
bytes (which formats any object) or an ndarray (np.remainder, which raises) has a % for it. The
static rule applies, as for +: an NDArray-typed reference to a chararray binds
NDArray's % (np.remainder).
Exceptions
- TypeError
The formatting's errors (the argument count, a conversion the value refuses:
%d format: a real number is required, not numpy.str_); an ndarray or a NumPy scalar on the left of a chararray:np.remainder's no-loop text; any other left operand:unsupported operand type(s) for %: 'int' and 'chararray'.- ValueError
A malformed format (
incomplete format); a NaN under an integer conversion;int()/float()of text that spells no number.- OverflowException
An infinity under an integer conversion; a
%cargument out of range.- IndexError
A
%(key)lookup on a NumPy scalar or an ndarray.- KeyError
A
%(key)missing from a dict.- IncorrectShapeException
The values do not broadcast against the chararray.
operator %(NDCharArray, string)
NumPy's chararray.mod: every element of the left chararray formatted with CPython's % against
the broadcast element of the right operand (np.char.asarray(np.char.mod(self, values))); with the
chararray on the RIGHT, the left operand's own % (chararray.rmod is NotImplemented).
public static NDCharArray operator %(NDCharArray left, string right)
Parameters
leftNDCharArrayThe left operand.
rightstringThe right operand.
Returns
- NDCharArray
A chararray on the left: the formatted chararray — an owning copy for
U, a view of the computed array forS— over the broadcast shape (np.@char.array(new[] { "%d", "%x" }) % 255is['255', 'ff']). A C# string, abyte[]or an element stand-in on the left: Python'sstr/bytesformatting with the right operand as its ONE argument, the result a read-only 0-d stand-in ("%s" % cisstr(c),"['a' 'b']";c[0] % 5formats the element's text).
Remarks
Python's dispatch: the chararray's mod answers when it is on the left; on the right only a str /
bytes (which formats any object) or an ndarray (np.remainder, which raises) has a % for it. The
static rule applies, as for +: an NDArray-typed reference to a chararray binds
NDArray's % (np.remainder).
Exceptions
- TypeError
The formatting's errors (the argument count, a conversion the value refuses:
%d format: a real number is required, not numpy.str_); an ndarray or a NumPy scalar on the left of a chararray:np.remainder's no-loop text; any other left operand:unsupported operand type(s) for %: 'int' and 'chararray'.- ValueError
A malformed format (
incomplete format); a NaN under an integer conversion;int()/float()of text that spells no number.- OverflowException
An infinity under an integer conversion; a
%cargument out of range.- IndexError
A
%(key)lookup on a NumPy scalar or an ndarray.- KeyError
A
%(key)missing from a dict.- IncorrectShapeException
The values do not broadcast against the chararray.
operator %(object, NDCharArray)
NumPy's chararray.mod: every element of the left chararray formatted with CPython's % against
the broadcast element of the right operand (np.char.asarray(np.char.mod(self, values))); with the
chararray on the RIGHT, the left operand's own % (chararray.rmod is NotImplemented).
public static NDCharArray operator %(object left, NDCharArray right)
Parameters
leftobjectThe left operand.
rightNDCharArrayThe right operand.
Returns
- NDCharArray
A chararray on the left: the formatted chararray — an owning copy for
U, a view of the computed array forS— over the broadcast shape (np.@char.array(new[] { "%d", "%x" }) % 255is['255', 'ff']). A C# string, abyte[]or an element stand-in on the left: Python'sstr/bytesformatting with the right operand as its ONE argument, the result a read-only 0-d stand-in ("%s" % cisstr(c),"['a' 'b']";c[0] % 5formats the element's text).
Remarks
Python's dispatch: the chararray's mod answers when it is on the left; on the right only a str /
bytes (which formats any object) or an ndarray (np.remainder, which raises) has a % for it. The
static rule applies, as for +: an NDArray-typed reference to a chararray binds
NDArray's % (np.remainder).
Exceptions
- TypeError
The formatting's errors (the argument count, a conversion the value refuses:
%d format: a real number is required, not numpy.str_); an ndarray or a NumPy scalar on the left of a chararray:np.remainder's no-loop text; any other left operand:unsupported operand type(s) for %: 'int' and 'chararray'.- ValueError
A malformed format (
incomplete format); a NaN under an integer conversion;int()/float()of text that spells no number.- OverflowException
An infinity under an integer conversion; a
%cargument out of range.- IndexError
A
%(key)lookup on a NumPy scalar or an ndarray.- KeyError
A
%(key)missing from a dict.- IncorrectShapeException
The values do not broadcast against the chararray.
operator %(string, NDCharArray)
NumPy's chararray.mod: every element of the left chararray formatted with CPython's % against
the broadcast element of the right operand (np.char.asarray(np.char.mod(self, values))); with the
chararray on the RIGHT, the left operand's own % (chararray.rmod is NotImplemented).
public static NDCharArray operator %(string left, NDCharArray right)
Parameters
leftstringThe left operand.
rightNDCharArrayThe right operand.
Returns
- NDCharArray
A chararray on the left: the formatted chararray — an owning copy for
U, a view of the computed array forS— over the broadcast shape (np.@char.array(new[] { "%d", "%x" }) % 255is['255', 'ff']). A C# string, abyte[]or an element stand-in on the left: Python'sstr/bytesformatting with the right operand as its ONE argument, the result a read-only 0-d stand-in ("%s" % cisstr(c),"['a' 'b']";c[0] % 5formats the element's text).
Remarks
Python's dispatch: the chararray's mod answers when it is on the left; on the right only a str /
bytes (which formats any object) or an ndarray (np.remainder, which raises) has a % for it. The
static rule applies, as for +: an NDArray-typed reference to a chararray binds
NDArray's % (np.remainder).
Exceptions
- TypeError
The formatting's errors (the argument count, a conversion the value refuses:
%d format: a real number is required, not numpy.str_); an ndarray or a NumPy scalar on the left of a chararray:np.remainder's no-loop text; any other left operand:unsupported operand type(s) for %: 'int' and 'chararray'.- ValueError
A malformed format (
incomplete format); a NaN under an integer conversion;int()/float()of text that spells no number.- OverflowException
An infinity under an integer conversion; a
%cargument out of range.- IndexError
A
%(key)lookup on a NumPy scalar or an ndarray.- KeyError
A
%(key)missing from a dict.- IncorrectShapeException
The values do not broadcast against the chararray.
operator *(NDArray, NDCharArray)
NumPy's chararray.mul / rmul: every string repeated by the integer count on the other
side (np.char.asarray(np.char.multiply(chars, count))), whichever side the chararray is on.
public static NDCharArray operator *(NDArray left, NDCharArray right)
Parameters
leftNDArrayThe left operand.
rightNDCharArrayThe right operand.
Returns
- NDCharArray
The repetition as a chararray (an owning copy for
U, a view forS).
Exceptions
- ValueError
A count that is not an integer, the C#
null(NumPy'sNone) included (Can only multiply by integers), or an empty result (zero-size array to reduction operation maximum which has no identity).- OverflowException
A repetition longer than
sys.maxsize.- IncorrectShapeException
The operands do not broadcast.
operator *(NDCharArray, NDArray)
NumPy's chararray.mul / rmul: every string repeated by the integer count on the other
side (np.char.asarray(np.char.multiply(chars, count))), whichever side the chararray is on.
public static NDCharArray operator *(NDCharArray left, NDArray right)
Parameters
leftNDCharArrayThe left operand.
rightNDArrayThe right operand.
Returns
- NDCharArray
The repetition as a chararray (an owning copy for
U, a view forS).
Exceptions
- ValueError
A count that is not an integer, the C#
null(NumPy'sNone) included (Can only multiply by integers), or an empty result (zero-size array to reduction operation maximum which has no identity).- OverflowException
A repetition longer than
sys.maxsize.- IncorrectShapeException
The operands do not broadcast.
operator *(NDCharArray, NDCharArray)
NumPy's chararray.mul / rmul: every string repeated by the integer count on the other
side (np.char.asarray(np.char.multiply(chars, count))), whichever side the chararray is on.
public static NDCharArray operator *(NDCharArray left, NDCharArray right)
Parameters
leftNDCharArrayThe left operand.
rightNDCharArrayThe right operand.
Returns
- NDCharArray
The repetition as a chararray (an owning copy for
U, a view forS).
Exceptions
- ValueError
A count that is not an integer, the C#
null(NumPy'sNone) included (Can only multiply by integers), or an empty result (zero-size array to reduction operation maximum which has no identity).- OverflowException
A repetition longer than
sys.maxsize.- IncorrectShapeException
The operands do not broadcast.
operator *(NDCharArray, object)
NumPy's chararray.mul / rmul: every string repeated by the integer count on the other
side (np.char.asarray(np.char.multiply(chars, count))), whichever side the chararray is on.
public static NDCharArray operator *(NDCharArray left, object right)
Parameters
leftNDCharArrayThe left operand.
rightobjectThe right operand.
Returns
- NDCharArray
The repetition as a chararray (an owning copy for
U, a view forS).
Exceptions
- ValueError
A count that is not an integer, the C#
null(NumPy'sNone) included (Can only multiply by integers), or an empty result (zero-size array to reduction operation maximum which has no identity).- OverflowException
A repetition longer than
sys.maxsize.- IncorrectShapeException
The operands do not broadcast.
operator *(NDCharArray, string)
NumPy's chararray.mul / rmul: every string repeated by the integer count on the other
side (np.char.asarray(np.char.multiply(chars, count))), whichever side the chararray is on.
public static NDCharArray operator *(NDCharArray left, string right)
Parameters
leftNDCharArrayThe left operand.
rightstringThe right operand.
Returns
- NDCharArray
The repetition as a chararray (an owning copy for
U, a view forS).
Exceptions
- ValueError
A count that is not an integer, the C#
null(NumPy'sNone) included (Can only multiply by integers), or an empty result (zero-size array to reduction operation maximum which has no identity).- OverflowException
A repetition longer than
sys.maxsize.- IncorrectShapeException
The operands do not broadcast.
operator *(object, NDCharArray)
NumPy's chararray.mul / rmul: every string repeated by the integer count on the other
side (np.char.asarray(np.char.multiply(chars, count))), whichever side the chararray is on.
public static NDCharArray operator *(object left, NDCharArray right)
Parameters
leftobjectThe left operand.
rightNDCharArrayThe right operand.
Returns
- NDCharArray
The repetition as a chararray (an owning copy for
U, a view forS).
Exceptions
- ValueError
A count that is not an integer, the C#
null(NumPy'sNone) included (Can only multiply by integers), or an empty result (zero-size array to reduction operation maximum which has no identity).- OverflowException
A repetition longer than
sys.maxsize.- IncorrectShapeException
The operands do not broadcast.
operator *(string, NDCharArray)
NumPy's chararray.mul / rmul: every string repeated by the integer count on the other
side (np.char.asarray(np.char.multiply(chars, count))), whichever side the chararray is on.
public static NDCharArray operator *(string left, NDCharArray right)
Parameters
leftstringThe left operand.
rightNDCharArrayThe right operand.
Returns
- NDCharArray
The repetition as a chararray (an owning copy for
U, a view forS).
Exceptions
- ValueError
A count that is not an integer, the C#
null(NumPy'sNone) included (Can only multiply by integers), or an empty result (zero-size array to reduction operation maximum which has no identity).- OverflowException
A repetition longer than
sys.maxsize.- IncorrectShapeException
The operands do not broadcast.