当前位置: 首页>>代码示例>>Python>>正文


Python multiarray._vec_string方法代码示例

本文整理汇总了Python中numpy.core.multiarray._vec_string方法的典型用法代码示例。如果您正苦于以下问题:Python multiarray._vec_string方法的具体用法?Python multiarray._vec_string怎么用?Python multiarray._vec_string使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在numpy.core.multiarray的用法示例。


在下文中一共展示了multiarray._vec_string方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: str_len

# 需要导入模块: from numpy.core import multiarray [as 别名]
# 或者: from numpy.core.multiarray import _vec_string [as 别名]
def str_len(a):
    """
    Return len(a) element-wise.

    Parameters
    ----------
    a : array_like of str or unicode

    Returns
    -------
    out : ndarray
        Output array of integers

    See also
    --------
    __builtin__.len
    """
    return _vec_string(a, integer, '__len__') 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:20,代码来源:defchararray.py

示例2: add

# 需要导入模块: from numpy.core import multiarray [as 别名]
# 或者: from numpy.core.multiarray import _vec_string [as 别名]
def add(x1, x2):
    """
    Return element-wise string concatenation for two arrays of str or unicode.

    Arrays `x1` and `x2` must have the same shape.

    Parameters
    ----------
    x1 : array_like of str or unicode
        Input array.
    x2 : array_like of str or unicode
        Input array.

    Returns
    -------
    add : ndarray
        Output array of `string_` or `unicode_`, depending on input types
        of the same shape as `x1` and `x2`.

    """
    arr1 = numpy.asarray(x1)
    arr2 = numpy.asarray(x2)
    out_size = _get_num_chars(arr1) + _get_num_chars(arr2)
    dtype = _use_unicode(arr1, arr2)
    return _vec_string(arr1, (dtype, out_size), '__add__', (arr2,)) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:27,代码来源:defchararray.py

示例3: mod

# 需要导入模块: from numpy.core import multiarray [as 别名]
# 或者: from numpy.core.multiarray import _vec_string [as 别名]
def mod(a, values):
    """
    Return (a % i), that is pre-Python 2.6 string formatting
    (iterpolation), element-wise for a pair of array_likes of str
    or unicode.

    Parameters
    ----------
    a : array_like of str or unicode

    values : array_like of values
       These values will be element-wise interpolated into the string.

    Returns
    -------
    out : ndarray
        Output array of str or unicode, depending on input types

    See also
    --------
    str.__mod__

    """
    return _to_string_or_unicode_array(
        _vec_string(a, object_, '__mod__', (values,))) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:27,代码来源:defchararray.py

示例4: isalnum

# 需要导入模块: from numpy.core import multiarray [as 别名]
# 或者: from numpy.core.multiarray import _vec_string [as 别名]
def isalnum(a):
    """
    Returns true for each element if all characters in the string are
    alphanumeric and there is at least one character, false otherwise.

    Calls `str.isalnum` element-wise.

    For 8-bit strings, this method is locale-dependent.

    Parameters
    ----------
    a : array_like of str or unicode

    Returns
    -------
    out : ndarray
        Output array of str or unicode, depending on input type

    See also
    --------
    str.isalnum
    """
    return _vec_string(a, bool_, 'isalnum') 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:25,代码来源:defchararray.py

示例5: isalpha

# 需要导入模块: from numpy.core import multiarray [as 别名]
# 或者: from numpy.core.multiarray import _vec_string [as 别名]
def isalpha(a):
    """
    Returns true for each element if all characters in the string are
    alphabetic and there is at least one character, false otherwise.

    Calls `str.isalpha` element-wise.

    For 8-bit strings, this method is locale-dependent.

    Parameters
    ----------
    a : array_like of str or unicode

    Returns
    -------
    out : ndarray
        Output array of bools

    See also
    --------
    str.isalpha
    """
    return _vec_string(a, bool_, 'isalpha') 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:25,代码来源:defchararray.py

示例6: isdigit

# 需要导入模块: from numpy.core import multiarray [as 别名]
# 或者: from numpy.core.multiarray import _vec_string [as 别名]
def isdigit(a):
    """
    Returns true for each element if all characters in the string are
    digits and there is at least one character, false otherwise.

    Calls `str.isdigit` element-wise.

    For 8-bit strings, this method is locale-dependent.

    Parameters
    ----------
    a : array_like of str or unicode

    Returns
    -------
    out : ndarray
        Output array of bools

    See also
    --------
    str.isdigit
    """
    return _vec_string(a, bool_, 'isdigit') 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:25,代码来源:defchararray.py

示例7: islower

# 需要导入模块: from numpy.core import multiarray [as 别名]
# 或者: from numpy.core.multiarray import _vec_string [as 别名]
def islower(a):
    """
    Returns true for each element if all cased characters in the
    string are lowercase and there is at least one cased character,
    false otherwise.

    Calls `str.islower` element-wise.

    For 8-bit strings, this method is locale-dependent.

    Parameters
    ----------
    a : array_like of str or unicode

    Returns
    -------
    out : ndarray
        Output array of bools

    See also
    --------
    str.islower
    """
    return _vec_string(a, bool_, 'islower') 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:26,代码来源:defchararray.py

示例8: istitle

# 需要导入模块: from numpy.core import multiarray [as 别名]
# 或者: from numpy.core.multiarray import _vec_string [as 别名]
def istitle(a):
    """
    Returns true for each element if the element is a titlecased
    string and there is at least one character, false otherwise.

    Call `str.istitle` element-wise.

    For 8-bit strings, this method is locale-dependent.

    Parameters
    ----------
    a : array_like of str or unicode

    Returns
    -------
    out : ndarray
        Output array of bools

    See also
    --------
    str.istitle
    """
    return _vec_string(a, bool_, 'istitle') 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:25,代码来源:defchararray.py

示例9: isupper

# 需要导入模块: from numpy.core import multiarray [as 别名]
# 或者: from numpy.core.multiarray import _vec_string [as 别名]
def isupper(a):
    """
    Returns true for each element if all cased characters in the
    string are uppercase and there is at least one character, false
    otherwise.

    Call `str.isupper` element-wise.

    For 8-bit strings, this method is locale-dependent.

    Parameters
    ----------
    a : array_like of str or unicode

    Returns
    -------
    out : ndarray
        Output array of bools

    See also
    --------
    str.isupper
    """
    return _vec_string(a, bool_, 'isupper') 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:26,代码来源:defchararray.py

示例10: join

# 需要导入模块: from numpy.core import multiarray [as 别名]
# 或者: from numpy.core.multiarray import _vec_string [as 别名]
def join(sep, seq):
    """
    Return a string which is the concatenation of the strings in the
    sequence `seq`.

    Calls `str.join` element-wise.

    Parameters
    ----------
    sep : array_like of str or unicode
    seq : array_like of str or unicode

    Returns
    -------
    out : ndarray
        Output array of str or unicode, depending on input types

    See also
    --------
    str.join
    """
    return _to_string_or_unicode_array(
        _vec_string(sep, object_, 'join', (seq,))) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:25,代码来源:defchararray.py

示例11: multiply

# 需要导入模块: from numpy.core import multiarray [as 别名]
# 或者: from numpy.core.multiarray import _vec_string [as 别名]
def multiply(a, i):
    """
    Return (a * i), that is string multiple concatenation,
    element-wise.

    Values in `i` of less than 0 are treated as 0 (which yields an
    empty string).

    Parameters
    ----------
    a : array_like of str or unicode

    i : array_like of ints

    Returns
    -------
    out : ndarray
        Output array of str or unicode, depending on input types

    """
    a_arr = numpy.asarray(a)
    i_arr = numpy.asarray(i)
    if not issubclass(i_arr.dtype.type, integer):
        raise ValueError("Can only multiply by integers")
    out_size = _get_num_chars(a_arr) * max(long(i_arr.max()), 0)
    return _vec_string(
        a_arr, (a_arr.dtype.type, out_size), '__mul__', (i_arr,)) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:29,代码来源:defchararray.py

示例12: capitalize

# 需要导入模块: from numpy.core import multiarray [as 别名]
# 或者: from numpy.core.multiarray import _vec_string [as 别名]
def capitalize(a):
    """
    Return a copy of `a` with only the first character of each element
    capitalized.

    Calls `str.capitalize` element-wise.

    For 8-bit strings, this method is locale-dependent.

    Parameters
    ----------
    a : array_like of str or unicode
        Input array of strings to capitalize.

    Returns
    -------
    out : ndarray
        Output array of str or unicode, depending on input
        types

    See also
    --------
    str.capitalize

    Examples
    --------
    >>> c = np.array(['a1b2','1b2a','b2a1','2a1b'],'S4'); c
    array(['a1b2', '1b2a', 'b2a1', '2a1b'],
        dtype='|S4')
    >>> np.char.capitalize(c)
    array(['A1b2', '1b2a', 'B2a1', '2a1b'],
        dtype='|S4')

    """
    a_arr = numpy.asarray(a)
    return _vec_string(a_arr, a_arr.dtype, 'capitalize') 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:38,代码来源:defchararray.py

示例13: encode

# 需要导入模块: from numpy.core import multiarray [as 别名]
# 或者: from numpy.core.multiarray import _vec_string [as 别名]
def encode(a, encoding=None, errors=None):
    """
    Calls `str.encode` element-wise.

    The set of available codecs comes from the Python standard library,
    and may be extended at runtime. For more information, see the codecs
    module.

    Parameters
    ----------
    a : array_like of str or unicode

    encoding : str, optional
       The name of an encoding

    errors : str, optional
       Specifies how to handle encoding errors

    Returns
    -------
    out : ndarray

    See also
    --------
    str.encode

    Notes
    -----
    The type of the result will depend on the encoding specified.

    """
    return _to_string_or_unicode_array(
        _vec_string(a, object_, 'encode', _clean_args(encoding, errors))) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:35,代码来源:defchararray.py

示例14: expandtabs

# 需要导入模块: from numpy.core import multiarray [as 别名]
# 或者: from numpy.core.multiarray import _vec_string [as 别名]
def expandtabs(a, tabsize=8):
    """
    Return a copy of each string element where all tab characters are
    replaced by one or more spaces.

    Calls `str.expandtabs` element-wise.

    Return a copy of each string element where all tab characters are
    replaced by one or more spaces, depending on the current column
    and the given `tabsize`. The column number is reset to zero after
    each newline occurring in the string. This doesn't understand other
    non-printing characters or escape sequences.

    Parameters
    ----------
    a : array_like of str or unicode
        Input array
    tabsize : int, optional
        Replace tabs with `tabsize` number of spaces.  If not given defaults
        to 8 spaces.

    Returns
    -------
    out : ndarray
        Output array of str or unicode, depending on input type

    See also
    --------
    str.expandtabs

    """
    return _to_string_or_unicode_array(
        _vec_string(a, object_, 'expandtabs', (tabsize,))) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:35,代码来源:defchararray.py

示例15: index

# 需要导入模块: from numpy.core import multiarray [as 别名]
# 或者: from numpy.core.multiarray import _vec_string [as 别名]
def index(a, sub, start=0, end=None):
    """
    Like `find`, but raises `ValueError` when the substring is not found.

    Calls `str.index` element-wise.

    Parameters
    ----------
    a : array_like of str or unicode

    sub : str or unicode

    start, end : int, optional

    Returns
    -------
    out : ndarray
        Output array of ints.  Returns -1 if `sub` is not found.

    See also
    --------
    find, str.find

    """
    return _vec_string(
        a, integer, 'index', [sub, start] + _clean_args(end)) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:28,代码来源:defchararray.py


注:本文中的numpy.core.multiarray._vec_string方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。