Skip to content

Commit 42acf07

Browse files
committed
REF: Special case NumericIndex._append_same_dtype()
1 parent 2f00159 commit 42acf07

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

pandas/core/dtypes/concat.py

+4
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,10 @@ def _concat_datetimetz(to_concat, name=None):
472472
return to_concat[0]._simple_new(new_values, tz=tz, name=name)
473473

474474

475+
def _concat_index_same_dtype(indexes):
476+
return indexes[0].__class__(np.concatenate([x._values for x in indexes]))
477+
478+
475479
def _concat_index_asobject(to_concat, name=None):
476480
"""
477481
concat all inputs as object. DatetimeIndex, TimedeltaIndex and

pandas/core/indexes/numeric.py

+4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from pandas.core.indexes.base import (
1818
Index, InvalidIndexError, _index_shared_docs)
1919
from pandas.util._decorators import Appender, cache_readonly
20+
import pandas.core.dtypes.concat as _concat
2021
import pandas.core.indexes.base as ibase
2122

2223

@@ -87,6 +88,9 @@ def _assert_safe_casting(cls, data, subarr):
8788
"""
8889
pass
8990

91+
def _concat_same_dtype(self, indexes, name):
92+
return _concat._concat_index_same_dtype(indexes).rename(name)
93+
9094
@property
9195
def is_all_dates(self):
9296
"""

0 commit comments

Comments
 (0)