Python Practice › NumPy Programs › Program 97

Floor of each element

EasyNumPy Programs · 97 of 100

Write a NumPy program to round elements down with floor.

Advertisement
Input
[4.8757, 2.4578]
Output
[4. 2.]

Approach

  1. np.floor.

Solution

Python
import numpy as npprint(np.floor([4.8757, 2.4578]))
Output
[4. 2.]

Learn the concept

New to this topic? Read the lesson, then come back.

More numpy programs

← All 100 NumPy Programs

Leave a Comment