# numpy.char.compare_chararrays

char.compare_chararrays(a1, a2, cmp, rstrip)

  Performs element-wise comparison of two string arrays using the comparison operator specified by cmp_op.

  Parameters
    a1, a2 array_like

      Arrays to be compared.

    cmp{“<”, “<=”, “==”, “>=”, “>”, “!=”}

      Type of comparison.

    rstrip Boolean

      If True, the spaces at the end of Strings are removed before the comparison.

  Returns
    out ndarray

      The output array of type Boolean with the same shape as a and b.

  Raises
    ValueError

      If cmp_op is not valid.

    TypeError

      If at least one of a or b is a non-string array

  Examples

      >>> a = np.array(["a", "b", "cde"])
      >>> b = np.array(["a", "a", "dec"])
      >>> np.compare_chararrays(a, b, ">", True)
      array([False,  True, False])

previous

numpy.char.less

next

numpy.char.count