10. Write a Python Numpy program to the number of alphabet "e" in the initial array.
The output is:
Initial Array = ['Python', 'Numpy', 'Free', 'Exercises']
Expected Answer:
Initial Array: ['Python' 'Numpy' 'Free' 'Exercises']
Number of 'e': [0 0 2 2]
Sample Answer:
import numpy as np a1 = np.array(['Python', 'Numpy', 'Free', 'Exercises'], dtype=np.str) print("Initial Array:", a1) b1 = np.char.count(a1, "e") print("\nNumber of 'e':", b1)
More Exercises:
Python String ExercisesMore Numpy Exercises:
Numpy String ExercisesMore Pandas Exercises:
Pandas Series ExercisesMore Tutorials:
Python Installation - Linux (Ubuntu)