NumPy char replace

NumPy char replace

In this chapter, we will discuss about NumPy char replace. This function returns a new copy of the input string in which all occurrences of the sequence of characters is replaced by another given sequence.

import numpy as np 
print np.char.replace ('He is a good boy', 'is', 'was')

Its output is as follows −

He was a good boy

Next Topic – Click Here

This Post Has 2 Comments

Leave a Reply