- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Return the largest integer smaller or equal to the division of the inputs in Numpy
To return the largest integer smaller or equal to the division of the inputs, use the numpy.floor_divide() method in Python Numpy. It returns the floor value after division. The parameter 1 is considered a Numerator. The parameter 2 is considered a Denominator.
The out is a location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned. A tuple (possible only as a keyword argument) must have length equal to the number of outputs.
The condition is broadcast over the input. At locations where the condition is True, the out array will be set to the ufunc result. Elsewhere, the out array will retain its original value. Note that if an uninitialized out array is created via the default out=None, locations within it where the condition is False will remain uninitialized.
Steps
At first, import the required library −
import numpy as np
Create an array −
arr = np.array([14, 28, 56, 84, 56, 112])
Display the array −
print("Array...
", arr)
Get the type of the array −
print("
Our Array type...
", arr.dtype)
Get the dimensions of the Array −
print("
Our Array Dimension...
",arr.ndim)
Get the shape of the Array −
print("
Our Array Shape...
",arr.shape)
Return the largest integer smaller or equal to the division of the inputs, use the numpy.floor_divide() method. It returns the floor value after division. The parameter 1 is considered a Numerator. The parameter 2 is considered a Denominator −
print("
Result...
",np.floor_divide(arr, 5))
Example
import numpy as np # Create an array arr = np.array([14, 28, 56, 84, 56, 112]) # Display the array print("Array...
", arr) # Get the type of the array print("
Our Array type...
", arr.dtype) # Get the dimensions of the Array print("
Our Array Dimension...
",arr.ndim) # Get the shape of the Array print("
Our Array Shape...
",arr.shape) # To return the largest integer smaller or equal to the division of the inputs, use the numpy.floor_divide() method in Python Numpy # It returns the floor value after division # The parameter 1 is considered a Numerator # The parameter 2 is considered a Denominator print("
Result...
",np.floor_divide(arr, 5))
Output
Array... [ 14 28 56 84 56 112] Our Array type... int64 Our Array Dimension... 1 Our Array Shape... (6,) Result... [ 2 5 11 16 11 22]
- Related Articles
- Return the ceil of the inputs in Numpy
- Return the truncated value of the inputs in Numpy
- Return the element-wise remainder of division in Numpy
- How to get the largest integer less than or equal to a number in JavaScript?
- Largest number smaller than or equal to N divisible by K in C++
- Return the element-wise remainder of division with modulo operation in Numpy
- Return the element-wise remainder of division with fmod() operation in Numpy
- Logarithm of the sum of exponentiations of the inputs in Numpy
- Return the remainder of division with dividend and divisor array-like in Numpy
- Count of smaller or equal elements in the sorted array in C++
- Return the truth value of an array equal to another element-wise in Numpy
- Logarithm of the sum of exponentiations of the inputs in base-2 in Numpy
- Return the truth value of an array not equal to another element-wise in Numpy
- Return the truth value of an array less than equal to another element-wise in Numpy
- Return the truth value of an array greater than equal to another element-wise in Numpy
