Answers for "NumPy trim_zeros Example when trim='f'"

0

NumPy trim_zeros Example when trim='f'

# welcome to softhunt.net
import numpy as np
softhunt = np.array((0, 0, 0, 0, 1, 3, 5, 7, 0, 9, 0, 11, 0, 0))

# without trim parameter
# returns an array without any leading zeros

res = np.trim_zeros(softhunt, 'f')
print(res)
Posted by: Guest on April-27-2022

Python Answers by Framework

Browse Popular Code Answers by Language