Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • Numpy exercise
  • pandas
  • Matplotlib
  • Data visulisation
  • EDA
  • Machin Learning
  • Deep Learning
  • NLP
  • Data science
  • ML Tutorial
  • Computer Vision
  • ML project
Open In App
Next Article:
Python | math.ceil() function
Next article icon

numpy.ceil() in Python

Last Updated : 08 Mar, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report
The numpy.ceil() is a mathematical function that returns the ceil of the elements of array. The ceil of the scalar x is the smallest integer i, such that i >= x
Syntax : numpy.ceil(x[, out]) = ufunc ‘ceil’) Parameters : a : [array_like] Input array Return : The ceil of each element with float data-type.
  Code #1 : Working Python3
# Python program explaining # ceil() function import numpy as np  in_array = [.5, 1.5, 2.5, 3.5, 4.5, 10.1] print ("Input array : \n", in_array)  ceiloff_values = np.ceil(in_array) print ("\nRounded values : \n", ceiloff_values)   in_array = [.53, 1.54, .71] print ("\nInput array : \n", in_array)  ceiloff_values = np.ceil(in_array) print ("\nRounded values : \n", ceiloff_values)  in_array = [.5538, 1.33354, .71445] print ("\nInput array : \n", in_array)  ceiloff_values = np.ceil(in_array) print ("\nRounded values : \n", ceiloff_values) 
Output :
  Input array :    [0.5, 1.5, 2.5, 3.5, 4.5, 10.1]    Rounded values :    [  1.   2.   3.   4.   5.  11.]    Input array :    [0.53, 1.54, 0.71]    Rounded values :    [ 1.  2.  1.]    Input array :    [0.5538, 1.33354, 0.71445]    Rounded values :    [ 1.  2.  1.]  
  Code #2 : Working Python3
# Python program explaining # ceil() function import numpy as np  in_array = [1.67, 4.5, 7, 9, 12] print ("Input array : \n", in_array)  ceiloff_values = np.ceil(in_array) print ("\nRounded values : \n", ceiloff_values)   in_array = [133.000, 344.54, 437.56, 44.9, 1.2] print ("\nInput array : \n", in_array)  ceiloff_values = np.ceil(in_array) print ("\nRounded values upto 2: \n", ceiloff_values) 
Output :
  Input array :    [1.67, 4.5, 7, 9, 12]    Rounded values :    [  2.   5.   7.   9.  12.]    Input array :    [133.0, 344.54, 437.56, 44.9, 1.2]    Rounded values upto 2:    [ 133.  345.  438.   45.    2.]
 

Next Article
Python | math.ceil() function
author
mohit gupta_omg :)
Improve
Article Tags :
  • Python
  • Python-numpy
  • Python numpy-Mathematical Function
Practice Tags :
  • python

Similar Reads

  • numpy.load() in Python
    numpy.load() function return the input array from a disk file with npy extension(.npy). Syntax : numpy.load(file, mmap_mode=None, allow_pickle=True, fix_imports=True, encoding='ASCII') Parameters: file : : file-like object, string, or pathlib.Path.The file to read. File-like objects must support the
    2 min read
  • Python | math.ceil() function
    In Python, math module contains a number of mathematical operations, which can be performed with ease using the module. math.ceil() function returns the smallest integral value greater than the number. If number is already integer, same number is returned. Syntax: math.ceil(x) Parameter: x: This is
    1 min read
  • numpy.who function - Python
    numpy.who() function print the NumPy arrays in the given dictionary. Syntax : numpy.who(vardict = None) Parameters : vardict : [dict, optional] A dictionary possibly containing ndarrays. Return : Returns ‘None’. If there is no dictionary passed in or vardict is None then returns NumPy arrays in the
    1 min read
  • eval in Python
    Python eval() function parse the expression argument and evaluate it as a Python expression and runs Python expression (code) within the program. Python eval() Function SyntaxSyntax: eval(expression, globals=None, locals=None) Parameters: expression: String is parsed and evaluated as a Python expres
    6 min read
  • ascii() in Python
    Python ascii() function returns a string containing a printable representation of an object and escapes the non-ASCII characters in the string using \x, \u or \U escapes. It's a built-in function that takes one argument and returns a string that represents the object using only ASCII characters. Exa
    3 min read
  • numpy.fromiter() function – Python
    NumPy's fromiter() function is a handy tool for creating a NumPy array from an iterable object. This iterable can be any Python object that provides elements one at a time. The function is especially useful when you need to convert data from a custom data source, like a file or generator, into a Num
    2 min read
  • numpy.mintypecode() function – Python
    numpy.mintypecode() function return the character for the minimum-size type to which given types can be safely cast. Syntax : numpy.mintypecode(typechars, typeset = 'GDFgdf', default = 'd') Parameters : typechars : [list of str or array_like] If a list of strings, each string should represent a dtyp
    1 min read
  • bin() in Python
    Python bin() function returns the binary string of a given integer. bin() function is used to convert integer to binary string. In this article, we will learn more about Python bin() function. Example In this example, we are using the bin() function to convert integer to binary string. C/C++ Code x
    2 min read
  • bool() in Python
    In Python, bool() is a built-in function that is used to convert a value to a Boolean (i.e., True or False). The Boolean data type represents truth values and is a fundamental concept in programming, often used in conditional statements, loops and logical operations. bool() function evaluates the tr
    4 min read
  • __getitem__() in Python
    __getitem__() is a special method (also known as a dunder or magic method) in Python that allows us to access an element from an object using square brackets, similar to how we access items in a list, tuple, or dictionary. It is commonly used to retrieve items from containers or objects that support
    3 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences