File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change 4040from pandas .core .dtypes .dtypes import (
4141 DatetimeTZDtype ,
4242 ExtensionDtype ,
43+ NumpyEADtype ,
4344 PeriodDtype ,
4445)
4546from pandas .core .dtypes .missing import array_equivalent
@@ -173,8 +174,14 @@ def take(
173174 fill_value = fill_value ,
174175 axis = axis ,
175176 )
176-
177- return type (self )._simple_new (new_data , new_data .dtype )
177+ if self .dtype in [
178+ NumpyEADtype (np .uint32 ),
179+ NumpyEADtype (np .uint64 ),
180+ NumpyEADtype (np .int32 ),
181+ NumpyEADtype (np .int64 ),
182+ ]:
183+ return type (self )(new_data )
184+ return self ._from_backing_data (new_data )
178185
179186 # ------------------------------------------------------------------------
180187
Original file line number Diff line number Diff line change @@ -331,7 +331,7 @@ def test_take_assigns_correct_dtype(dtype):
331331
332332 result = array .take ([- 1 ], allow_fill = True )
333333
334- assert result .dtype == np .float64
334+ assert result .dtype == NumpyEADtype ( np .float64 )
335335
336336
337337# ----------------------------------------------------------------------------
You can’t perform that action at this time.
0 commit comments