Skip to content

Commit acdc94f

Browse files
authored
CLN: dont mix Int64Index into PeriodIndex (#38045)
1 parent d0afefa commit acdc94f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

pandas/core/indexes/period.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def _new_PeriodIndex(cls, **d):
6565
wrap=True,
6666
)
6767
@inherit_names(["is_leap_year", "_format_native_types"], PeriodArray)
68-
class PeriodIndex(DatetimeIndexOpsMixin, Int64Index):
68+
class PeriodIndex(DatetimeIndexOpsMixin):
6969
"""
7070
Immutable ndarray holding ordinal values indicating regular periods in time.
7171
@@ -436,8 +436,7 @@ def join(self, other, how="left", level=None, return_indexers=False, sort=False)
436436
)
437437

438438
# _assert_can_do_setop ensures we have matching dtype
439-
result = Int64Index.join(
440-
self,
439+
result = super().join(
441440
other,
442441
how=how,
443442
level=level,

pandas/io/pytables.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
is_list_like,
4545
is_string_dtype,
4646
is_timedelta64_dtype,
47+
needs_i8_conversion,
4748
)
4849
from pandas.core.dtypes.missing import array_equivalent
4950

@@ -4771,7 +4772,7 @@ def _convert_index(name: str, index: Index, encoding: str, errors: str) -> Index
47714772
kind = _dtype_to_kind(dtype_name)
47724773
atom = DataIndexableCol._get_atom(converted)
47734774

4774-
if isinstance(index, Int64Index):
4775+
if isinstance(index, Int64Index) or needs_i8_conversion(index.dtype):
47754776
# Includes Int64Index, RangeIndex, DatetimeIndex, TimedeltaIndex, PeriodIndex,
47764777
# in which case "kind" is "integer", "integer", "datetime64",
47774778
# "timedelta64", and "integer", respectively.

0 commit comments

Comments
 (0)