Please note, this is a STATIC archive of website www.w3resource.com from 19 Jul 2022, cach3.com does not collect or store any user information, there is no "phishing" involved.
w3resource

NumPy: lower() function

numpy.core.defchararray.lower() function

The numpy.core.defchararray.lower() function returns an array with the elements converted to lowercase.

Version: 1.15.0

Syntax:

numpy.core.defchararray.lower(a)

Parameter:

Name Description Required /
Optional
a: array_like, {str, unicode} Input array. Required

Return value:

out : ndarray, {str, unicode} - Output array of str or unicode, depending on input type.

Note:

The 'chararray' class exists for backwards compatibility with Numarray, it is not recommended for new development. Starting from numpy 1.4, if one needs arrays of strings, it is recommended to use arrays of 'dtype' 'object_', 'string_' or 'unicode_', and use the free functions in the 'numpy.char' module for fast vectorized string operations.

Some methods will only be available if the corresponding string method is available in your version of Python.

The preferred alias for 'defchararray' is 'numpy.char'.

Example: numpy.lower() function

>>> import numpy as np
>>> x = np.array(['A1B C', '1BCA', 'BCA1']); x
array(['A1B C', '1BCA', 'BCA1'], dtype='<U5')
>>> np.char.lower(x)
array(['a1b c', '1bca', 'bca1'], dtype='*lt;U5')

Pictorial Presentation:

NumPy String operation: lower() function

Python - NumPy Code Editor:

Previous: ljust()
Next: lstrip()