Skip to content

Commit c82ddcd

Browse files
jbrockmendeljreback
authored andcommitted
REF: use _data.take for CI/DTI/TDI/PI.take (#30650)
1 parent fde137c commit c82ddcd

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

pandas/core/indexes/category.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -728,13 +728,13 @@ def take(self, indices, axis=0, allow_fill=True, fill_value=None, **kwargs):
728728
nv.validate_take(tuple(), kwargs)
729729
indices = ensure_platform_int(indices)
730730
taken = self._assert_take_fillable(
731-
self.codes,
731+
self._data,
732732
indices,
733733
allow_fill=allow_fill,
734734
fill_value=fill_value,
735-
na_value=-1,
735+
na_value=self._data.dtype.na_value,
736736
)
737-
return self._create_from_codes(taken)
737+
return self._shallow_copy(taken)
738738

739739
take_nd = take
740740

pandas/core/indexes/datetimelike.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -274,11 +274,11 @@ def take(self, indices, axis=0, allow_fill=True, fill_value=None, **kwargs):
274274
return self[maybe_slice]
275275

276276
taken = self._assert_take_fillable(
277-
self.asi8,
277+
self._data,
278278
indices,
279279
allow_fill=allow_fill,
280280
fill_value=fill_value,
281-
na_value=iNaT,
281+
na_value=NaT,
282282
)
283283

284284
# keep freq in PeriodArray/Index, reset otherwise

0 commit comments

Comments
 (0)