Wednesday, July 3, 2024
HomeLanguagesPythonPython | Numpy np.min_scalar_type() method

Python | Numpy np.min_scalar_type() method

With the help of np.min_scalar_type() method, we can get the minimum scalar type of a value that is passed as a parameter in np.min_scalar_type() method.

Syntax : np.min_scalar_type(value)
Return : Return the minimum scalar type of a value.

Example #1 :
In this example we can see that by using np.min_scalar_type() method, we are able to get the minimum scalar type of a value by using this method.




# import numpy
import numpy as np
  
# using np.min_scalar_type() method
gfg = np.min_scalar_type(-50)
  
print(gfg)


Output :

int8

Example #2 :




# import numpy
import numpy as np
  
# using np.min_scalar_type() method
gfg = np.min_scalar_type(55.56)
  
print(gfg)


Output :

float16

Thapelo Manthata
I’m a desktop support specialist transitioning into a SharePoint developer role by day and Software Engineering student by night. My superpowers include customer service, coding, the Microsoft office 365 suite including SharePoint and power platform.
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments