Open In App

Python | Numpy np.min_scalar_type() method

Improve
Improve
Like Article
Like
Save
Share
Report

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


Last Updated : 03 Nov, 2019
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads