Saved Bookmarks
| 1. |
Write a program to transform elements of a given string to a numeric string of 10 digits by making all the elements of a given string to a numeric string of 8 digits with zeros on the left. |
|
Answer» Sample Solution:- import numpy as np# Create Sample NumPy array arr = np.array(['22', '9', '1234', '567', '89102'], dtype=str) zeroes_filled_arr = np.char.zfill(arr, 8) print("Transformed array: ") print(zeroes_filled_arr) Output: Transformed array:['00000022' '00000009' '00001234' '00000567' '00089102'] |
|