Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

python
communitycreator

What is the numpy.char.upper() function from NumPy in Python?

Onyejiaku Theophilus Chidalu

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Overview

In Python, the char.upper() function is used to convert the elements of an array to uppercase.

Syntax

char.upper(a)

Parameters

This function takes a single parameter value, a, representing the input array.

Return value

This function returns an array of strings or Unicode, depending on the input type.

Example

import numpy as np
# creating an array
myarray = np.array(["That", "there", "TheSE", "tHEY"])
# implementing the char.upper() function
print(np.char.upper(myarray))
Implementing the char.upper() function

Explanation

  • Line 1: We import the numpy module.
  • Line 4: We use the array() function to create an array of strings myarray.
  • Line 7: We implement the char.uppper() function on myarray, and print the result to the console.

RELATED TAGS

python
communitycreator

CONTRIBUTOR

Onyejiaku Theophilus Chidalu

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring