7. Write a Python Numpy program to separate the initial array into their respective words.
The output is:
Initial Array: [' python numpy pandas free exercises ']
Expected Answer:
Separate the element of the intiial array with spaces: [list(['python', 'numpy', 'pandas', 'free',
'exercises'])]
Sample Answer:
import numpy as np a = np.array([' python ' ' numpy ' ' pandas ' ' free ' ' exercises '], dtype=np.str) print("Initial Array:", a) b = np.char.split(a) print("\nSeparate the element of the intiial array with spaces: ", b)
More Exercises:
Python String ExercisesMore Numpy Exercises:
Numpy String ExercisesMore Pandas Exercises:
Pandas Series ExercisesMore Tutorials:
Python Installation - Linux (Ubuntu)