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.

filter_none

edit
close

play_arrow

link
brightness_4
code

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

chevron_right


Output :

int8



Example #2 :

filter_none

edit
close

play_arrow

link
brightness_4
code

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

chevron_right


Output :

float16

My Personal Notes arrow_drop_up

Recommended Posts: