Skip to content

Commit d010c4a

Browse files
topper-123Terji PetersenTerji Petersen
authored
DEPR: Remove int64 uint64 float64 index part 1 (#49560)
* DEPR: don't make Index instantiate Int64/Uint64/Flaot64Index * fix precommit * fix various issues * np.int_ -> np.intp * update * float16 & groupby.nlargest/nsmallest tests * small fix * tests/window/test_groupby.py types * Revert "np.int_ -> np.intp" This reverts commit d759966. * fixes for comments * fix intp->int_ error * fix interval * fix groupby value_counts * fix comments * fix more comments * fix stuff * fix Co-authored-by: Terji Petersen <[email protected]> Co-authored-by: Terji Petersen <[email protected]>
1 parent b37589a commit d010c4a

File tree

85 files changed

+573
-436
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+573
-436
lines changed

pandas/core/arrays/datetimes.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -1384,7 +1384,7 @@ def isocalendar(self) -> DataFrame:
13841384
0 2000
13851385
1 2001
13861386
2 2002
1387-
dtype: int64
1387+
dtype: int32
13881388
""",
13891389
)
13901390
month = _field_accessor(
@@ -1407,7 +1407,7 @@ def isocalendar(self) -> DataFrame:
14071407
0 1
14081408
1 2
14091409
2 3
1410-
dtype: int64
1410+
dtype: int32
14111411
""",
14121412
)
14131413
day = _field_accessor(
@@ -1430,7 +1430,7 @@ def isocalendar(self) -> DataFrame:
14301430
0 1
14311431
1 2
14321432
2 3
1433-
dtype: int64
1433+
dtype: int32
14341434
""",
14351435
)
14361436
hour = _field_accessor(
@@ -1453,7 +1453,7 @@ def isocalendar(self) -> DataFrame:
14531453
0 0
14541454
1 1
14551455
2 2
1456-
dtype: int64
1456+
dtype: int32
14571457
""",
14581458
)
14591459
minute = _field_accessor(
@@ -1476,7 +1476,7 @@ def isocalendar(self) -> DataFrame:
14761476
0 0
14771477
1 1
14781478
2 2
1479-
dtype: int64
1479+
dtype: int32
14801480
""",
14811481
)
14821482
second = _field_accessor(
@@ -1499,7 +1499,7 @@ def isocalendar(self) -> DataFrame:
14991499
0 0
15001500
1 1
15011501
2 2
1502-
dtype: int64
1502+
dtype: int32
15031503
""",
15041504
)
15051505
microsecond = _field_accessor(
@@ -1522,7 +1522,7 @@ def isocalendar(self) -> DataFrame:
15221522
0 0
15231523
1 1
15241524
2 2
1525-
dtype: int64
1525+
dtype: int32
15261526
""",
15271527
)
15281528
nanosecond = _field_accessor(
@@ -1545,7 +1545,7 @@ def isocalendar(self) -> DataFrame:
15451545
0 0
15461546
1 1
15471547
2 2
1548-
dtype: int64
1548+
dtype: int32
15491549
""",
15501550
)
15511551
_dayofweek_doc = """
@@ -1580,7 +1580,7 @@ def isocalendar(self) -> DataFrame:
15801580
2017-01-06 4
15811581
2017-01-07 5
15821582
2017-01-08 6
1583-
Freq: D, dtype: int64
1583+
Freq: D, dtype: int32
15841584
"""
15851585
day_of_week = _field_accessor("day_of_week", "dow", _dayofweek_doc)
15861586
dayofweek = day_of_week

pandas/core/arrays/interval.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@
4646
from pandas.errors import IntCastingNaNError
4747
from pandas.util._decorators import Appender
4848

49-
from pandas.core.dtypes.cast import LossySetitemError
49+
from pandas.core.dtypes.cast import (
50+
LossySetitemError,
51+
maybe_upcast_numeric_to_64bit,
52+
)
5053
from pandas.core.dtypes.common import (
5154
is_categorical_dtype,
5255
is_dtype_equal,
@@ -304,7 +307,10 @@ def _ensure_simple_new_inputs(
304307
from pandas.core.indexes.base import ensure_index
305308

306309
left = ensure_index(left, copy=copy)
310+
left = maybe_upcast_numeric_to_64bit(left)
311+
307312
right = ensure_index(right, copy=copy)
313+
right = maybe_upcast_numeric_to_64bit(right)
308314

309315
if closed is None and isinstance(dtype, IntervalDtype):
310316
closed = dtype.closed

pandas/core/arrays/timedeltas.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ def total_seconds(self) -> npt.NDArray[np.float64]:
771771
dtype='timedelta64[ns]', freq=None)
772772
773773
>>> idx.total_seconds()
774-
Float64Index([0.0, 86400.0, 172800.0, 259200.0, 345600.0],
774+
NumericIndex([0.0, 86400.0, 172800.0, 259200.0, 345600.0],
775775
dtype='float64')
776776
"""
777777
pps = periods_per_second(self._creso)

pandas/core/generic.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6096,7 +6096,7 @@ def astype(
60966096
0 1
60976097
1 2
60986098
dtype: category
6099-
Categories (2, int64): [1, 2]
6099+
Categories (2, int32): [1, 2]
61006100
61016101
Convert to ordered categorical type with custom ordering:
61026102

pandas/core/indexes/accessors.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ class DatetimeProperties(Properties):
161161
0 0
162162
1 1
163163
2 2
164-
dtype: int64
164+
dtype: int32
165165
166166
>>> hours_series = pd.Series(pd.date_range("2000-01-01", periods=3, freq="h"))
167167
>>> hours_series
@@ -173,7 +173,7 @@ class DatetimeProperties(Properties):
173173
0 0
174174
1 1
175175
2 2
176-
dtype: int64
176+
dtype: int32
177177
178178
>>> quarters_series = pd.Series(pd.date_range("2000-01-01", periods=3, freq="q"))
179179
>>> quarters_series
@@ -185,7 +185,7 @@ class DatetimeProperties(Properties):
185185
0 1
186186
1 2
187187
2 3
188-
dtype: int64
188+
dtype: int32
189189
190190
Returns a Series indexed like the original Series.
191191
Raises TypeError if the Series does not contain datetimelike values.
@@ -303,7 +303,7 @@ class TimedeltaProperties(Properties):
303303
0 1
304304
1 2
305305
2 3
306-
dtype: int64
306+
dtype: int32
307307
"""
308308

309309
def to_pytimedelta(self) -> np.ndarray:

0 commit comments

Comments
 (0)