Skip to content

Commit

Permalink
DEPR: Remove int64 uint64 float64 index part 1 (#49560)
Browse files Browse the repository at this point in the history
* 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 <terjipetersen@Terjis-Air.fritz.box>
Co-authored-by: Terji Petersen <terjipetersen@Terjis-MacBook-Air.local>
  • Loading branch information
3 people committed Jan 13, 2023
1 parent b37589a commit d010c4a
Show file tree
Hide file tree
Showing 85 changed files with 573 additions and 436 deletions.
18 changes: 9 additions & 9 deletions pandas/core/arrays/datetimes.py
Expand Up @@ -1384,7 +1384,7 @@ def isocalendar(self) -> DataFrame:
0 2000
1 2001
2 2002
dtype: int64
dtype: int32
""",
)
month = _field_accessor(
Expand All @@ -1407,7 +1407,7 @@ def isocalendar(self) -> DataFrame:
0 1
1 2
2 3
dtype: int64
dtype: int32
""",
)
day = _field_accessor(
Expand All @@ -1430,7 +1430,7 @@ def isocalendar(self) -> DataFrame:
0 1
1 2
2 3
dtype: int64
dtype: int32
""",
)
hour = _field_accessor(
Expand All @@ -1453,7 +1453,7 @@ def isocalendar(self) -> DataFrame:
0 0
1 1
2 2
dtype: int64
dtype: int32
""",
)
minute = _field_accessor(
Expand All @@ -1476,7 +1476,7 @@ def isocalendar(self) -> DataFrame:
0 0
1 1
2 2
dtype: int64
dtype: int32
""",
)
second = _field_accessor(
Expand All @@ -1499,7 +1499,7 @@ def isocalendar(self) -> DataFrame:
0 0
1 1
2 2
dtype: int64
dtype: int32
""",
)
microsecond = _field_accessor(
Expand All @@ -1522,7 +1522,7 @@ def isocalendar(self) -> DataFrame:
0 0
1 1
2 2
dtype: int64
dtype: int32
""",
)
nanosecond = _field_accessor(
Expand All @@ -1545,7 +1545,7 @@ def isocalendar(self) -> DataFrame:
0 0
1 1
2 2
dtype: int64
dtype: int32
""",
)
_dayofweek_doc = """
Expand Down Expand Up @@ -1580,7 +1580,7 @@ def isocalendar(self) -> DataFrame:
2017-01-06 4
2017-01-07 5
2017-01-08 6
Freq: D, dtype: int64
Freq: D, dtype: int32
"""
day_of_week = _field_accessor("day_of_week", "dow", _dayofweek_doc)
dayofweek = day_of_week
Expand Down
8 changes: 7 additions & 1 deletion pandas/core/arrays/interval.py
Expand Up @@ -46,7 +46,10 @@
from pandas.errors import IntCastingNaNError
from pandas.util._decorators import Appender

from pandas.core.dtypes.cast import LossySetitemError
from pandas.core.dtypes.cast import (
LossySetitemError,
maybe_upcast_numeric_to_64bit,
)
from pandas.core.dtypes.common import (
is_categorical_dtype,
is_dtype_equal,
Expand Down Expand Up @@ -304,7 +307,10 @@ def _ensure_simple_new_inputs(
from pandas.core.indexes.base import ensure_index

left = ensure_index(left, copy=copy)
left = maybe_upcast_numeric_to_64bit(left)

right = ensure_index(right, copy=copy)
right = maybe_upcast_numeric_to_64bit(right)

if closed is None and isinstance(dtype, IntervalDtype):
closed = dtype.closed
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/arrays/timedeltas.py
Expand Up @@ -771,7 +771,7 @@ def total_seconds(self) -> npt.NDArray[np.float64]:
dtype='timedelta64[ns]', freq=None)
>>> idx.total_seconds()
Float64Index([0.0, 86400.0, 172800.0, 259200.0, 345600.0],
NumericIndex([0.0, 86400.0, 172800.0, 259200.0, 345600.0],
dtype='float64')
"""
pps = periods_per_second(self._creso)
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/generic.py
Expand Up @@ -6096,7 +6096,7 @@ def astype(
0 1
1 2
dtype: category
Categories (2, int64): [1, 2]
Categories (2, int32): [1, 2]
Convert to ordered categorical type with custom ordering:
Expand Down
8 changes: 4 additions & 4 deletions pandas/core/indexes/accessors.py
Expand Up @@ -161,7 +161,7 @@ class DatetimeProperties(Properties):
0 0
1 1
2 2
dtype: int64
dtype: int32
>>> hours_series = pd.Series(pd.date_range("2000-01-01", periods=3, freq="h"))
>>> hours_series
Expand All @@ -173,7 +173,7 @@ class DatetimeProperties(Properties):
0 0
1 1
2 2
dtype: int64
dtype: int32
>>> quarters_series = pd.Series(pd.date_range("2000-01-01", periods=3, freq="q"))
>>> quarters_series
Expand All @@ -185,7 +185,7 @@ class DatetimeProperties(Properties):
0 1
1 2
2 3
dtype: int64
dtype: int32
Returns a Series indexed like the original Series.
Raises TypeError if the Series does not contain datetimelike values.
Expand Down Expand Up @@ -303,7 +303,7 @@ class TimedeltaProperties(Properties):
0 1
1 2
2 3
dtype: int64
dtype: int32
"""

def to_pytimedelta(self) -> np.ndarray:
Expand Down

0 comments on commit d010c4a

Please sign in to comment.