Write a NumPy program to replace "PHP" with "Python" in the element of a given array.
import numpy as np x = np.array(['PHP Exercises, Practice, Solution'], dtype=np.str) print("\nOriginal Array:") print(x) r = np.char.replace(x, "PHP", "Python") print("\nNew array:") print(r)
Sample Input:
(['PHP Exercises, Practice, Solution'], dtype=np.str)
Sample Output:
Original Array: ['PHP Exercises, Practice, Solution'] New array: ['Python Exercises, Practice, Solution']
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Sample Input:
Sample Output:
need an explanation for this answer? contact us directly to get an explanation for this answer