bundles / numpy 2.4.4 / numpy / strings / lstrip
function
numpy.strings:lstrip
source: /numpy/_core/strings.py :942
Signature
def lstrip ( a , chars = None ) Summary
For each element in a, return a copy with the leading characters removed.
Parameters
a: array-like, with ``StringDType``, ``bytes_``, or ``str_`` dtypechars: scalar with the same dtype as ``a``, optionalThe
charsargument is a string specifying the set of characters to be removed. IfNone, thecharsargument defaults to removing whitespace. Thecharsargument is not a prefix or suffix; rather, all combinations of its values are stripped.
Returns
out: ndarrayOutput array of
StringDType,bytes_orstr_dtype, depending on input types
Examples
import numpy as np c = np.array(['aAaAaA', ' aA ', 'abBABba'])✓
c
✗np.strings.lstrip(c, 'a') np.strings.lstrip(c, 'A') # leaves c unchanged (np.strings.lstrip(c, ' ') == np.strings.lstrip(c, '')).all() (np.strings.lstrip(c, ' ') == np.strings.lstrip(c)).all()✓
See also
- str.lstrip
Aliases
-
numpy.char.lstrip