Q:

Write a NumPy program to split the element of a given array with spaces

0

Write a NumPy program to split the element of a given array with spaces.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

import numpy as np
x = np.array(['Python PHP Java C++'], dtype=np.str)
print("Original Array:")
print(x)
r = np.char.split(x)
print("\nSplit the element of the said array with spaces: ")
print(r)

Sample Input:

(['Python PHP Java C++'], dtype=np.str)

Sample Output:

Original Array:
['Python PHP Java C++']

Split the element of the said array with spaces: 
[list(['Python', 'PHP', 'Java', 'C++'])]

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now