Movatterモバイル変換


[0]ホーム

URL:


SciPy

numpy.mintypecode

numpy.mintypecode(typechars,typeset='GDFgdf',default='d')[source]

Return the character for the minimum-size type to which given types canbe safely cast.

The returned type character must represent the smallest size dtype suchthat an array of the returned type can handle the data from an array ofall types intypechars (or iftypechars is an array, then itsdtype.char).

Parameters:
typechars:list of str or array_like

If a list of strings, each string should represent a dtype.If array_like, the character representation of the array dtype is used.

typeset:str or list of str, optional

The set of characters that the returned character is chosen from.The default set is ‘GDFgdf’.

default:str, optional

The default character, this is returned if none of the characters intypechars matches a character intypeset.

Returns:
typechar:str

The character representing the minimum-size type that was found.

See also

dtype,sctype2char,maximum_sctype

Examples

>>>np.mintypecode(['d','f','S'])'d'>>>x=np.array([1.1,2-3.j])>>>np.mintypecode(x)'D'
>>>np.mintypecode('abceh',default='G')'G'

Previous topic

numpy.sctype2char

Next topic

Optionally Scipy-accelerated routines (numpy.dual)

Quick search

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

[8]ページ先頭

©2009-2025 Movatter.jp