How to get the range of valid Numpy data types?

前端 未结 2 714
感情败类
感情败类 2020-12-29 01:22

I\'m interested in finding for a particular Numpy type (e.g. np.int64, np.uint32, np.float32, etc.) what the range of all possible val

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-29 01:43

    Quoting from a numpy discussion list:

    That information is available via numpy.finfo() and numpy.iinfo():
    
    In [12]: finfo('d').max
    Out[12]: 1.7976931348623157e+308
    
    In [13]: iinfo('i').max
    Out[13]: 2147483647
    
    In [14]: iinfo('uint8').max
    Out[14]: 255
    

    Link here.

提交回复
热议问题