5. Write a Python Numpy program to include a space in between of initial array.
The output is:
Initial Array = ['python', 'numpy', 'pandas']
Expected Answer:
New Array: ['p y t h o n' 'n u m p y' 'p a n d a s']
Sample Answer:
import numpy as np a = np.array(['python', 'numpy', 'pandas'], dtype=np.str) print("Initial Array:", a) b = np.char.join(" ", a) print("\nNew Array:", b)
More Exercises:
Python String ExercisesMore Numpy Exercises:
Numpy String ExercisesMore Pandas Exercises:
Pandas Series ExercisesMore Tutorials:
Python Installation - Linux (Ubuntu)