Movatterモバイル変換


[0]ホーム

URL:


SciPy

numpy.array_repr

numpy.array_repr(arr,max_line_width=None,precision=None,suppress_small=None)[source]

Return the string representation of an array.

Parameters:

arr : ndarray

Input array.

max_line_width : int, optional

The maximum number of columns the string should span. Newlinecharacters split the string appropriately after array elements.

precision : int, optional

Floating point precision. Default is the current printing precision(usually 8), which can be altered usingset_printoptions.

suppress_small : bool, optional

Represent very small numbers as zero, default is False. Very smallis defined byprecision, if the precision is 8 thennumbers smaller than 5e-9 are represented as zero.

Returns:

string : str

The string representation of an array.

Examples

>>>np.array_repr(np.array([1,2]))'array([1, 2])'>>>np.array_repr(np.ma.array([0.]))'MaskedArray([ 0.])'>>>np.array_repr(np.array([],np.int32))'array([], dtype=int32)'
>>>x=np.array([1e-6,4e-7,2,3])>>>np.array_repr(x,precision=6,suppress_small=True)'array([ 0.000001,  0.      ,  2.      ,  3.      ])'

Previous topic

numpy.array2string

Next topic

numpy.array_str

  • © Copyright 2008-2009, The Scipy community.
  • Last updated on Jun 10, 2017.
  • Created usingSphinx 1.5.3.

[8]ページ先頭

©2009-2025 Movatter.jp