Answers for "NumPy trim_zeros Example with default value trim='fb'"

0

NumPy trim_zeros Example with default value trim='fb'

# 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 leading and trailing zeros

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

Python Answers by Framework

Browse Popular Code Answers by Language