@@ -5028,3 +5028,184 @@ def add_newdoc(place, name, doc):
5028
5028
array(['001', '-01', '+01'], dtype='<U3')
5029
5029
5030
5030
""" )
5031
+
5032
+ add_newdoc ('numpy._core.umath' , '_partition_index' ,
5033
+ """
5034
+ Partition each element in ``x1`` around ``x2``, at precomputed
5035
+ index ``x3``.
5036
+
5037
+ For each element in ``x1``, split the element at the first
5038
+ occurrence of ``x2`` at location ``x3``, and return a 3-tuple
5039
+ containing the part before the separator, the separator itself,
5040
+ and the part after the separator. If the separator is not found,
5041
+ the first item of the tuple will contain the whole string, and
5042
+ the second and third ones will be the empty string.
5043
+
5044
+ Parameters
5045
+ ----------
5046
+ x1 : array-like, with ``bytes_``, or ``str_`` dtype
5047
+ Input array
5048
+ x2 : array-like, with ``bytes_``, or ``str_`` dtype
5049
+ Separator to split each string element in ``x1``.
5050
+ x3 : array-like, with any integer dtype
5051
+ The indices of the separator (<0 to indicate the separator is not
5052
+ present).
5053
+
5054
+ Returns
5055
+ -------
5056
+ out : 3-tuple:
5057
+ - array with ``bytes_`` or ``str_`` dtype with the part before the
5058
+ separator
5059
+ - array with ``bytes_`` or ``str_`` dtype with the separator
5060
+ - array with ``bytes_`` or ``str_`` dtype with the part after the
5061
+ separator
5062
+
5063
+ See Also
5064
+ --------
5065
+ str.partition
5066
+
5067
+ Examples
5068
+ --------
5069
+ The ufunc is used most easily via ``np.strings.partition``,
5070
+ which calls it after calculating the indices::
5071
+
5072
+ >>> x = np.array(["Numpy is nice!"])
5073
+ >>> np.strings.partition(x, " ")
5074
+ (array(['Numpy'], dtype='<U5'),
5075
+ array([' '], dtype='<U1'),
5076
+ array(['is nice!'], dtype='<U8'))
5077
+
5078
+ """ )
5079
+
5080
+ add_newdoc ('numpy._core.umath' , '_rpartition_index' ,
5081
+ """
5082
+ Partition each element in ``x1`` around the right-most separator,
5083
+ ``x2``, at precomputed index ``x3``.
5084
+
5085
+ For each element in ``x1``, split the element at the last
5086
+ occurrence of ``x2`` at location ``x3``, and return a 3-tuple
5087
+ containing the part before the separator, the separator itself,
5088
+ and the part after the separator. If the separator is not found,
5089
+ the third item of the tuple will contain the whole string, and
5090
+ the first and second ones will be the empty string.
5091
+
5092
+ Parameters
5093
+ ----------
5094
+ x1 : array-like, with ``bytes_``, or ``str_`` dtype
5095
+ Input array
5096
+ x2 : array-like, with ``bytes_``, or ``str_`` dtype
5097
+ Separator to split each string element in ``x1``.
5098
+ x3 : array-like, with any integer dtype
5099
+ The indices of the separator (<0 to indicate the separator is not
5100
+ present).
5101
+
5102
+ Returns
5103
+ -------
5104
+ out : 3-tuple:
5105
+ - array with ``bytes_`` or ``str_`` dtype with the part before the
5106
+ separator
5107
+ - array with ``bytes_`` or ``str_`` dtype with the separator
5108
+ - array with ``bytes_`` or ``str_`` dtype with the part after the
5109
+ separator
5110
+
5111
+ See Also
5112
+ --------
5113
+ str.rpartition
5114
+
5115
+ Examples
5116
+ --------
5117
+ The ufunc is used most easily via ``np.strings.rpartition``,
5118
+ which calls it after calculating the indices::
5119
+
5120
+ >>> a = np.array(['aAaAaA', ' aA ', 'abBABba'])
5121
+ >>> np.strings.rpartition(a, 'A')
5122
+ (array(['aAaAa', ' a', 'abB'], dtype='<U5'),
5123
+ array(['A', 'A', 'A'], dtype='<U1'),
5124
+ array(['', ' ', 'Bba'], dtype='<U3'))
5125
+
5126
+ """ )
5127
+
5128
+ add_newdoc ('numpy._core.umath' , '_partition' ,
5129
+ """
5130
+ Partition each element in ``x1`` around ``x2``.
5131
+
5132
+ For each element in ``x1``, split the element at the first
5133
+ occurrence of ``x2`` and return a 3-tuple containing the part before
5134
+ the separator, the separator itself, and the part after the
5135
+ separator. If the separator is not found, the first item of the
5136
+ tuple will contain the whole string, and the second and third ones
5137
+ will be the empty string.
5138
+
5139
+ Parameters
5140
+ ----------
5141
+ x1 : array-like, with ``StringDType`` dtype
5142
+ Input array
5143
+ x2 : array-like, with ``StringDType`` dtype
5144
+ Separator to split each string element in ``x1``.
5145
+
5146
+ Returns
5147
+ -------
5148
+ out : 3-tuple:
5149
+ - ``StringDType`` array with the part before the separator
5150
+ - ``StringDType`` array with the separator
5151
+ - ``StringDType`` array with the part after the separator
5152
+
5153
+ See Also
5154
+ --------
5155
+ str.partition
5156
+
5157
+ Examples
5158
+ --------
5159
+ The ufunc is used most easily via ``np.strings.partition``,
5160
+ which calls it under the hood::
5161
+
5162
+ >>> x = np.array(["Numpy is nice!"], dtype="T")
5163
+ >>> np.strings.partition(x, " ")
5164
+ (array(['Numpy'], dtype=StringDType()),
5165
+ array([' '], dtype=StringDType()),
5166
+ array(['is nice!'], dtype=StringDType()))
5167
+
5168
+ """ )
5169
+
5170
+ add_newdoc ('numpy._core.umath' , '_rpartition' ,
5171
+ """
5172
+ Partition each element in ``x1`` around the right-most separator,
5173
+ ``x2``.
5174
+
5175
+ For each element in ``x1``, split the element at the last
5176
+ occurrence of ``x2`` at location ``x3``, and return a 3-tuple
5177
+ containing the part before the separator, the separator itself,
5178
+ and the part after the separator. If the separator is not found,
5179
+ the third item of the tuple will contain the whole string, and
5180
+ the first and second ones will be the empty string.
5181
+
5182
+ Parameters
5183
+ ----------
5184
+ x1 : array-like, with ``StringDType`` dtype
5185
+ Input array
5186
+ x2 : array-like, with ``StringDType`` dtype
5187
+ Separator to split each string element in ``x1``.
5188
+
5189
+ Returns
5190
+ -------
5191
+ out : 3-tuple:
5192
+ - ``StringDType`` array with the part before the separator
5193
+ - ``StringDType`` array with the separator
5194
+ - ``StringDType`` array with the part after the separator
5195
+
5196
+ See Also
5197
+ --------
5198
+ str.rpartition
5199
+
5200
+ Examples
5201
+ --------
5202
+ The ufunc is used most easily via ``np.strings.rpartition``,
5203
+ which calls it after calculating the indices::
5204
+
5205
+ >>> a = np.array(['aAaAaA', ' aA ', 'abBABba'], dtype="T")
5206
+ >>> np.strings.rpartition(a, 'A')
5207
+ (array(['aAaAa', ' a', 'abB'], dtype=StringDType()),
5208
+ array(['A', 'A', 'A'], dtype=StringDType()),
5209
+ array(['', ' ', 'Bba'], dtype=StringDType()))
5210
+
5211
+ """ )
0 commit comments