Python | Numpy method np.min_scalar_type ()



Using the np.min_scalar_type() method, we can get the minimum scalar type of the value passed as a parameter to np.min_scalar_type () .

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

Example # 1:
In this example, we see that with np.min_scalar_type () we can get the minimum scalar value type with this method.

# NumPy import

import numpy as np

 
# using the np.min_scalar_type () method

gfg = np.min_scalar_type ( - 50 )

 

print (gfg)

Output:

int8

Example # 2:

# NumPy import

import numpy as np

 
# using the np.min_scalar_type () method

gfg = np.min_scalar_type ( 55.56 )

 

print (gfg)

Output:

float16