Skip to content

Commit 990c31a

Browse files
committed
Merge branch 'main' into enh-list-arith
2 parents d3257cf + 54c26ec commit 990c31a

File tree

36 files changed

+176
-73
lines changed

36 files changed

+176
-73
lines changed

doc/make.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def _process_single_doc(self, single_doc):
105105
@staticmethod
106106
def _run_os(*args) -> None:
107107
"""
108-
Execute a command as a OS terminal.
108+
Execute a command as an OS terminal.
109109
110110
Parameters
111111
----------

doc/source/whatsnew/v3.0.0.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -981,6 +981,7 @@ Datetimelike
981981
- Bug in :meth:`DataFrame.fillna` raising an ``AssertionError`` instead of ``OutOfBoundsDatetime`` when filling a ``datetime64[ns]`` column with an out-of-bounds timestamp. Now correctly raises ``OutOfBoundsDatetime``. (:issue:`61208`)
982982
- Bug in :meth:`DataFrame.min` and :meth:`DataFrame.max` casting ``datetime64`` and ``timedelta64`` columns to ``float64`` and losing precision (:issue:`60850`)
983983
- Bug in :meth:`Dataframe.agg` with df with missing values resulting in IndexError (:issue:`58810`)
984+
- Bug in :meth:`DateOffset.rollback` (and subclass methods) with ``normalize=True`` rolling back one offset too long (:issue:`32616`)
984985
- Bug in :meth:`DatetimeIndex.is_year_start` and :meth:`DatetimeIndex.is_quarter_start` does not raise on Custom business days frequencies bigger then "1C" (:issue:`58664`)
985986
- Bug in :meth:`DatetimeIndex.is_year_start` and :meth:`DatetimeIndex.is_quarter_start` returning ``False`` on double-digit frequencies (:issue:`58523`)
986987
- Bug in :meth:`DatetimeIndex.union` and :meth:`DatetimeIndex.intersection` when ``unit`` was non-nanosecond (:issue:`59036`)
@@ -1050,6 +1051,7 @@ Interval
10501051
- Bug in :class:`Index`, :class:`Series`, :class:`DataFrame` constructors when given a sequence of :class:`Interval` subclass objects casting them to :class:`Interval` (:issue:`46945`)
10511052
- Bug in :func:`interval_range` where start and end numeric types were always cast to 64 bit (:issue:`57268`)
10521053
- Bug in :meth:`IntervalIndex.get_indexer` and :meth:`IntervalIndex.drop` when one of the sides of the index is non-unique (:issue:`52245`)
1054+
- Construction of :class:`IntervalArray` and :class:`IntervalIndex` from arrays with mismatched signed/unsigned integer dtypes (e.g., ``int64`` and ``uint64``) now raises a :exc:`TypeError` instead of proceeding silently. (:issue:`55715`)
10531055

10541056
Indexing
10551057
^^^^^^^^
@@ -1237,6 +1239,7 @@ Other
12371239
- Bug in :meth:`DataFrame.query` where using duplicate column names led to a ``TypeError``. (:issue:`59950`)
12381240
- Bug in :meth:`DataFrame.query` which raised an exception or produced incorrect results when expressions contained backtick-quoted column names containing the hash character ``#``, backticks, or characters that fall outside the ASCII range (U+0001..U+007F). (:issue:`59285`) (:issue:`49633`)
12391241
- Bug in :meth:`DataFrame.query` which raised an exception when querying integer column names using backticks. (:issue:`60494`)
1242+
- Bug in :meth:`DataFrame.rename` and :meth:`Series.rename` when passed a ``mapper``, ``index``, or ``columns`` argument that is a :class:`Series` with non-unique ``ser.index`` producing a corrupted result instead of raising ``ValueError`` (:issue:`58621`)
12401243
- Bug in :meth:`DataFrame.sample` with ``replace=False`` and ``(n * max(weights) / sum(weights)) > 1``, the method would return biased results. Now raises ``ValueError``. (:issue:`61516`)
12411244
- Bug in :meth:`DataFrame.shift` where passing a ``freq`` on a DataFrame with no columns did not shift the index correctly. (:issue:`60102`)
12421245
- Bug in :meth:`DataFrame.sort_index` when passing ``axis="columns"`` and ``ignore_index=True`` and ``ascending=False`` not returning a :class:`RangeIndex` columns (:issue:`57293`)

pandas/_config/localization.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def can_set_locale(lc: str, lc_var: int = locale.LC_ALL) -> bool:
7979
with set_locale(lc, lc_var=lc_var):
8080
pass
8181
except (ValueError, locale.Error):
82-
# horrible name for a Exception subclass
82+
# horrible name for an Exception subclass
8383
return False
8484
else:
8585
return True

pandas/_libs/tslibs/offsets.pyx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,9 @@ cdef class BaseOffset:
692692
Rolled timestamp if not on offset, otherwise unchanged timestamp.
693693
"""
694694
dt = Timestamp(dt)
695+
if self.normalize and (dt - dt.normalize())._value != 0:
696+
# GH#32616
697+
dt = dt.normalize()
695698
if not self.is_on_offset(dt):
696699
dt = dt - type(self)(1, normalize=self.normalize, **self.kwds)
697700
return dt

pandas/core/arrays/arrow/array.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -829,6 +829,14 @@ def __arrow_array__(self, type=None):
829829
"""Convert myself to a pyarrow ChunkedArray."""
830830
return self._pa_array
831831

832+
def __array_ufunc__(self, ufunc: np.ufunc, method: str, *inputs, **kwargs):
833+
# Need to wrap np.array results GH#62800
834+
result = super().__array_ufunc__(ufunc, method, *inputs, **kwargs)
835+
if type(self) is ArrowExtensionArray:
836+
# Exclude ArrowStringArray
837+
return type(self)._from_sequence(result)
838+
return result
839+
832840
def __array__(
833841
self, dtype: NpDtype | None = None, copy: bool | None = None
834842
) -> np.ndarray:

pandas/core/arrays/categorical.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ class Categorical(NDArrayBackedExtensionArray, PandasObject, ObjectStringArrayMi
269269
categories are assumed to be the unique values of `values` (sorted, if
270270
possible, otherwise in the order in which they appear).
271271
ordered : bool, default False
272-
Whether or not this categorical is treated as a ordered categorical.
272+
Whether or not this categorical is treated as an ordered categorical.
273273
If True, the resulting categorical will be ordered.
274274
An ordered categorical respects, when sorted, the order of its
275275
`categories` attribute (which in turn is the `categories` argument, if
@@ -1103,7 +1103,7 @@ def set_categories(
11031103
new_categories : Index-like
11041104
The categories in new order.
11051105
ordered : bool, default None
1106-
Whether or not the categorical is treated as a ordered categorical.
1106+
Whether or not the categorical is treated as an ordered categorical.
11071107
If not given, do not change the ordered information.
11081108
rename : bool, default False
11091109
Whether or not the new_categories should be considered as a rename
@@ -1277,7 +1277,7 @@ def reorder_categories(self, new_categories, ordered=None) -> Self:
12771277
new_categories : Index-like
12781278
The categories in new order.
12791279
ordered : bool, optional
1280-
Whether or not the categorical is treated as a ordered categorical.
1280+
Whether or not the categorical is treated as an ordered categorical.
12811281
If not given, do not change the ordered information.
12821282
12831283
Returns

pandas/core/arrays/interval.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,18 @@ def _ensure_simple_new_inputs(
420420

421421
dtype = IntervalDtype(left.dtype, closed=closed)
422422

423+
# Check for mismatched signed/unsigned integer dtypes after casting
424+
left_dtype = left.dtype
425+
right_dtype = right.dtype
426+
if (
427+
left_dtype.kind in "iu"
428+
and right_dtype.kind in "iu"
429+
and left_dtype.kind != right_dtype.kind
430+
):
431+
raise TypeError(
432+
f"Left and right arrays must have matching signedness. "
433+
f"Got {left_dtype} and {right_dtype}."
434+
)
423435
return left, right, dtype
424436

425437
@classmethod

pandas/core/arrays/timedeltas.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1212,7 +1212,7 @@ def _objects_to_td64ns(
12121212
data, unit=None, errors: DateTimeErrorChoices = "raise"
12131213
) -> np.ndarray:
12141214
"""
1215-
Convert a object-dtyped or string-dtyped array into an
1215+
Convert an object-dtyped or string-dtyped array into a
12161216
timedelta64[ns]-dtyped array.
12171217
12181218
Parameters

pandas/core/dtypes/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ class Registry:
517517
"""
518518
Registry for dtype inference.
519519
520-
The registry allows one to map a string repr of a extension
520+
The registry allows one to map a string repr of an extension
521521
dtype to an extension dtype. The string alias can be used in several
522522
places, including
523523

pandas/core/dtypes/dtypes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ class CategoricalDtype(PandasExtensionDtype, ExtensionDtype):
176176
The categories are stored in an Index,
177177
and if an index is provided the dtype of that index will be used.
178178
ordered : bool or None, default False
179-
Whether or not this categorical is treated as a ordered categorical.
179+
Whether or not this categorical is treated as an ordered categorical.
180180
None can be used to maintain the ordered value of existing categoricals when
181181
used in operations that combine categoricals, e.g. astype, and will resolve to
182182
False if there is no existing ordered to maintain.

0 commit comments

Comments
 (0)