Articles → Numpy → Trunc Function In NumpyTrunc Function In NumpyIn this article, we will discuss trunc function in NumPy.Purpose Trunc of scalar x returns the nearest integer I which is closer to zero than x.Example import numpy as np in_array = np.array([-9.5, -0.5, 0, 1.5,5.5] ) print("Trunc Operation:", np.trunc(in_array))Output Click to EnlargePosted By - Karan Gupta Posted On - Monday, June 24, 2019 Query/Feedback Your Email Id** Subject* Query/Feedback Characters remaining 250**
import numpy as np in_array = np.array([-9.5, -0.5, 0, 1.5,5.5] ) print("Trunc Operation:", np.trunc(in_array))
Query/Feedback