Movatterモバイル変換


[0]ホーム

URL:


SciPy

numpy.core.defchararray.asarray

numpy.core.defchararray.asarray(obj,itemsize=None,unicode=None,order=None)[source]

Convert the input to achararray, copying the data only ifnecessary.

Versus a regular NumPy array of typestr orunicode, thisclass adds the following functionality:

  1. values automatically have whitespace removed from the endwhen indexed
  2. comparison operators automatically remove whitespace from theend when comparing values
  3. vectorized string operations are provided as methods(e.g.str.endswith) and infix operators (e.g.+,*,``%``)
Parameters:

obj : array of str or unicode-like

itemsize : int, optional

itemsize is the number of characters per scalar in theresulting array. Ifitemsize is None, andobj is anobject array or a Python list, theitemsize will beautomatically determined. Ifitemsize is provided andobjis of type str or unicode, then theobj string will bechunked intoitemsize pieces.

unicode : bool, optional

When true, the resultingchararray can contain Unicodecharacters, when false only 8-bit characters. If unicode isNone andobj is one of the following:

  • achararray,
  • an ndarray of typestr or ‘unicode`
  • a Python str or unicode object,

then the unicode setting of the output array will beautomatically determined.

order : {‘C’, ‘F’}, optional

Specify the order of the array. If order is ‘C’ (default), then thearray will be in C-contiguous order (last-index varies thefastest). If order is ‘F’, then the returned arraywill be in Fortran-contiguous order (first-index varies thefastest).

Previous topic

numpy.core.records.fromfile

Next topic

numpy.arange

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

[8]ページ先頭

©2009-2025 Movatter.jp