Skip to content

Commit 3151692

Browse files
jbrockmendelJulianWgs
authored andcommitted
CLN: assorted follow-ups (pandas-dev#41772)
1 parent 37cb788 commit 3151692

File tree

6 files changed

+9
-7
lines changed

6 files changed

+9
-7
lines changed

doc/source/whatsnew/v1.3.0.rst

+1
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,7 @@ Other API changes
643643
- Partially initialized :class:`CategoricalDtype` (i.e. those with ``categories=None`` objects will no longer compare as equal to fully initialized dtype objects.
644644
- Accessing ``_constructor_expanddim`` on a :class:`DataFrame` and ``_constructor_sliced`` on a :class:`Series` now raise an ``AttributeError``. Previously a ``NotImplementedError`` was raised (:issue:`38782`)
645645
- Added new ``engine`` and ``**engine_kwargs`` parameters to :meth:`DataFrame.to_sql` to support other future "SQL engines". Currently we still only use ``SQLAlchemy`` under the hood, but more engines are planned to be supported such as ``turbodbc`` (:issue:`36893`)
646+
- Removed redundant ``freq`` from :class:`PeriodIndex` string representation (:issue:`41653`)
646647

647648
Build
648649
=====

pandas/_libs/lib.pyx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1461,7 +1461,7 @@ def infer_dtype(value: object, skipna: bool = True) -> str:
14611461
for i in range(n):
14621462
val = values[i]
14631463

1464-
# do not use is_nul_datetimelike to keep
1464+
# do not use is_null_datetimelike to keep
14651465
# np.datetime64('nat') and np.timedelta64('nat')
14661466
if val is None or util.is_nan(val):
14671467
pass

pandas/core/algorithms.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1266,14 +1266,14 @@ def compute(self, method: str) -> Series:
12661266
return dropped.sort_values(ascending=ascending).head(n)
12671267

12681268
# fast method
1269-
arr, pandas_dtype = _ensure_data(dropped.values)
1269+
arr, new_dtype = _ensure_data(dropped.values)
12701270
if method == "nlargest":
12711271
arr = -arr
1272-
if is_integer_dtype(pandas_dtype):
1272+
if is_integer_dtype(new_dtype):
12731273
# GH 21426: ensure reverse ordering at boundaries
12741274
arr -= 1
12751275

1276-
elif is_bool_dtype(pandas_dtype):
1276+
elif is_bool_dtype(new_dtype):
12771277
# GH 26154: ensure False is smaller than True
12781278
arr = 1 - (-arr)
12791279

pandas/core/arrays/datetimes.py

-1
Original file line numberDiff line numberDiff line change
@@ -2104,7 +2104,6 @@ def sequence_to_dt64ns(
21042104
result = data.view(DT64NS_DTYPE)
21052105

21062106
if copy:
2107-
# TODO: should this be deepcopy?
21082107
result = result.copy()
21092108

21102109
assert isinstance(result, np.ndarray), type(result)

pandas/core/arrays/period.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,7 @@ def start_time(self) -> DatetimeArray:
866866
def end_time(self) -> DatetimeArray:
867867
return self.to_timestamp(how="end")
868868

869-
def _require_matching_freq(self, other, base=False):
869+
def _require_matching_freq(self, other, base: bool = False) -> None:
870870
# See also arrays.period.raise_on_incompatible
871871
if isinstance(other, BaseOffset):
872872
other_freq = other
@@ -1057,7 +1057,7 @@ def dt64arr_to_periodarr(data, freq, tz=None):
10571057
10581058
Returns
10591059
-------
1060-
ordinals : ndarray[int]
1060+
ordinals : ndarray[int64]
10611061
freq : Tick
10621062
The frequency extracted from the Series or DatetimeIndex if that's
10631063
used.

pandas/core/indexes/base.py

+2
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,7 @@ def _engine(self) -> libindex.IndexEngine:
776776
target_values = self._get_engine_target()
777777
return self._engine_type(lambda: target_values, len(self))
778778

779+
@final
779780
@cache_readonly
780781
def _dir_additions_for_owner(self) -> set[str_t]:
781782
"""
@@ -6209,6 +6210,7 @@ def shape(self) -> Shape:
62096210
# See GH#27775, GH#27384 for history/reasoning in how this is defined.
62106211
return (len(self),)
62116212

6213+
@final
62126214
def _deprecated_arg(self, value, name: str_t, methodname: str_t) -> None:
62136215
"""
62146216
Issue a FutureWarning if the arg/kwarg is not no_default.

0 commit comments

Comments
 (0)