Movatterモバイル変換


[0]ホーム

URL:


SciPy

numpy.common_type

numpy.common_type(*arrays)[source]

Return a scalar type which is common to the input arrays.

The return type will always be an inexact (i.e. floating point) scalartype, even if all the arrays are integer arrays. If one of the inputs isan integer array, the minimum precision type that is returned is a64-bit floating point dtype.

All input arrays except int64 and uint64 can be safely cast to thereturned dtype without loss of information.

Parameters:
array1, array2, …:ndarrays

Input arrays.

Returns:
out:data type code

Data type code.

Examples

>>>np.common_type(np.arange(2,dtype=np.float32))<type 'numpy.float32'>>>>np.common_type(np.arange(2,dtype=np.float32),np.arange(2))<type 'numpy.float64'>>>>np.common_type(np.arange(4),np.array([45,6.j]),np.array([45.0]))<type 'numpy.complex128'>

Previous topic

numpy.result_type

Next topic

numpy.obj2sctype

Quick search

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

[8]ページ先頭

©2009-2025 Movatter.jp