Skip to content

Commit 5fa7f31

Browse files
authored
CLN: assorted (#53086)
1 parent b0140bf commit 5fa7f31

File tree

27 files changed

+64
-96
lines changed

27 files changed

+64
-96
lines changed

doc/source/whatsnew/v2.1.0.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ Metadata
439439

440440
Other
441441
^^^^^
442-
- Bug in :class:`FloatingArray.__contains__` with ``NaN`` item incorrectly returning ``False`` when ``NaN`` values are presnet (:issue:`52840`)
442+
- Bug in :class:`FloatingArray.__contains__` with ``NaN`` item incorrectly returning ``False`` when ``NaN`` values are present (:issue:`52840`)
443443
- Bug in :func:`assert_almost_equal` now throwing assertion error for two unequal sets (:issue:`51727`)
444444
- Bug in :func:`assert_frame_equal` checks category dtypes even when asked not to check index type (:issue:`52126`)
445445
- Bug in :meth:`DataFrame.reindex` with a ``fill_value`` that should be inferred with a :class:`ExtensionDtype` incorrectly inferring ``object`` dtype (:issue:`52586`)

pandas/_libs/algos.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ def kth_smallest(numeric_t[::1] arr, Py_ssize_t k) -> numeric_t:
346346
def nancorr(const float64_t[:, :] mat, bint cov=False, minp=None):
347347
cdef:
348348
Py_ssize_t i, xi, yi, N, K
349-
bint minpv
349+
int64_t minpv
350350
float64_t[:, ::1] result
351351
ndarray[uint8_t, ndim=2] mask
352352
int64_t nobs = 0
@@ -357,7 +357,7 @@ def nancorr(const float64_t[:, :] mat, bint cov=False, minp=None):
357357
if minp is None:
358358
minpv = 1
359359
else:
360-
minpv = <int>minp
360+
minpv = <int64_t>minp
361361

362362
result = np.empty((K, K), dtype=np.float64)
363363
mask = np.isfinite(mat).view(np.uint8)

pandas/_libs/index.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ from pandas._typing import npt
55
from pandas import MultiIndex
66
from pandas.core.arrays import ExtensionArray
77

8+
multiindex_nulls_shift: int
9+
810
class IndexEngine:
911
over_size_threshold: bool
1012
def __init__(self, values: np.ndarray) -> None: ...

pandas/_libs/internals.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,5 +102,5 @@ class BlockValuesRefs:
102102
referenced_blocks: list[weakref.ref]
103103
def __init__(self, blk: SharedBlock | None = ...) -> None: ...
104104
def add_reference(self, blk: SharedBlock) -> None: ...
105-
def add_index_reference(self, index: object) -> None: ...
105+
def add_index_reference(self, index: Index) -> None: ...
106106
def has_reference(self) -> bool: ...

pandas/_libs/internals.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -966,7 +966,7 @@ cdef class BlockValuesRefs:
966966

967967
Parameters
968968
----------
969-
index: object
969+
index : Index
970970
The index that the new reference should point to.
971971
"""
972972
self.referenced_blocks.append(weakref.ref(index))

pandas/_libs/lib.pyx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2612,7 +2612,7 @@ def maybe_convert_objects(ndarray[object] objects,
26122612
return tdi._data._ndarray
26132613
seen.object_ = True
26142614

2615-
if seen.period_:
2615+
elif seen.period_:
26162616
if is_period_array(objects):
26172617
from pandas import PeriodIndex
26182618
pi = PeriodIndex(objects)
@@ -2621,7 +2621,7 @@ def maybe_convert_objects(ndarray[object] objects,
26212621
return pi._data
26222622
seen.object_ = True
26232623

2624-
if seen.interval_:
2624+
elif seen.interval_:
26252625
if is_interval_array(objects):
26262626
from pandas import IntervalIndex
26272627
ii = IntervalIndex(objects)
@@ -2631,7 +2631,7 @@ def maybe_convert_objects(ndarray[object] objects,
26312631

26322632
seen.object_ = True
26332633

2634-
if seen.nat_:
2634+
elif seen.nat_:
26352635
if not seen.object_ and not seen.numeric_ and not seen.bool_:
26362636
# all NaT, None, or nan (at least one NaT)
26372637
# see GH#49340 for discussion of desired behavior

pandas/_testing/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -852,9 +852,7 @@ def _constructor_sliced(self):
852852

853853

854854
class SubclassedCategorical(Categorical):
855-
@property
856-
def _constructor(self):
857-
return SubclassedCategorical
855+
pass
858856

859857

860858
def _make_skipna_wrapper(alternative, skipna_alternative=None):

pandas/core/algorithms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1240,7 +1240,7 @@ def take(
12401240
if not is_array_like(arr):
12411241
arr = np.asarray(arr)
12421242

1243-
indices = np.asarray(indices, dtype=np.intp)
1243+
indices = ensure_platform_int(indices)
12441244

12451245
if allow_fill:
12461246
# Pandas style, -1 means NA

pandas/core/apply.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,15 +1086,10 @@ def agg(self):
10861086
result = super().agg()
10871087
if result is None:
10881088
f = self.f
1089-
kwargs = self.kwargs
10901089

10911090
# string, list-like, and dict-like are entirely handled in super
10921091
assert callable(f)
10931092

1094-
# we can be called from an inner function which
1095-
# passes this meta-data
1096-
kwargs.pop("_level", None)
1097-
10981093
# try a regular apply, this evaluates lambdas
10991094
# row-by-row; however if the lambda is expected a Series
11001095
# expression, e.g.: lambda x: x-x.quantile(0.25)

pandas/core/array_algos/putmask.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def setitem_datetimelike_compat(values: np.ndarray, num_set: int, other):
138138
if values.dtype == object:
139139
dtype, _ = infer_dtype_from(other)
140140

141-
if isinstance(dtype, np.dtype) and dtype.kind in "mM":
141+
if lib.is_np_dtype(dtype, "mM"):
142142
# https://github.com/numpy/numpy/issues/12550
143143
# timedelta64 will incorrectly cast to int
144144
if not is_list_like(other):

0 commit comments

Comments
 (0)