Movatterモバイル変換


[0]ホーム

URL:


SciPy

numpy.min_scalar_type

numpy.min_scalar_type(a)

For scalara, returns the data type with the smallest sizeand smallest scalar kind which can hold its value. For non-scalararraya, returns the vector’s dtype unmodified.

Floating point values are not demoted to integers,and complex values are not demoted to floats.

Parameters:
a:scalar or array_like

The value whose minimal data type is to be found.

Returns:
out:dtype

The minimal data type.

Notes

New in version 1.6.0.

Examples

>>>np.min_scalar_type(10)dtype('uint8')
>>>np.min_scalar_type(-260)dtype('int16')
>>>np.min_scalar_type(3.1)dtype('float16')
>>>np.min_scalar_type(1e50)dtype('float64')
>>>np.min_scalar_type(np.arange(4,dtype='f8'))dtype('float64')

Previous topic

numpy.promote_types

Next topic

numpy.result_type

Quick search

  • © Copyright 2008-2018, The SciPy community.
  • Last updated on Jul 24, 2018.
  • Created usingSphinx 1.6.6.

[8]ページ先頭

©2009-2026 Movatter.jp