@@ -164,64 +164,6 @@ def _take_nd_ndarray(
164164 return out
165165
166166
167- def take_1d (
168- arr : ArrayLike ,
169- indexer : npt .NDArray [np .intp ],
170- fill_value = None ,
171- allow_fill : bool = True ,
172- mask : npt .NDArray [np .bool_ ] | None = None ,
173- ) -> ArrayLike :
174- """
175- Specialized version for 1D arrays. Differences compared to `take_nd`:
176-
177- - Assumes input array has already been converted to numpy array / EA
178- - Assumes indexer is already guaranteed to be intp dtype ndarray
179- - Only works for 1D arrays
180-
181- To ensure the lowest possible overhead.
182-
183- Note: similarly to `take_nd`, this function assumes that the indexer is
184- a valid(ated) indexer with no out of bound indices.
185-
186- Parameters
187- ----------
188- arr : np.ndarray or ExtensionArray
189- Input array.
190- indexer : ndarray
191- 1-D array of indices to take (validated indices, intp dtype).
192- fill_value : any, default np.nan
193- Fill value to replace -1 values with
194- allow_fill : bool, default True
195- If False, indexer is assumed to contain no -1 values so no filling
196- will be done. This short-circuits computation of a mask. Result is
197- undefined if allow_fill == False and -1 is present in indexer.
198- mask : np.ndarray, optional, default None
199- If `allow_fill` is True, and the mask (where indexer == -1) is already
200- known, it can be passed to avoid recomputation.
201- """
202- if not isinstance (arr , np .ndarray ):
203- # ExtensionArray -> dispatch to their method
204- return arr .take (indexer , fill_value = fill_value , allow_fill = allow_fill )
205-
206- if not allow_fill :
207- return arr .take (indexer )
208-
209- dtype , fill_value , mask_info = _take_preprocess_indexer_and_fill_value (
210- arr , indexer , fill_value , True , mask
211- )
212-
213- # at this point, it's guaranteed that dtype can hold both the arr values
214- # and the fill_value
215- out = np .empty (indexer .shape , dtype = dtype )
216-
217- func = _get_take_nd_function (
218- arr .ndim , arr .dtype , out .dtype , axis = 0 , mask_info = mask_info
219- )
220- func (arr , indexer , out , fill_value )
221-
222- return out
223-
224-
225167def take_2d_multi (
226168 arr : np .ndarray ,
227169 indexer : tuple [npt .NDArray [np .intp ], npt .NDArray [np .intp ]],
0 commit comments