Skip to content

Commit 6c08e8e

Browse files
authored
Merge branch 'main' into issue60928
2 parents 40d832d + 48b1571 commit 6c08e8e

Some content is hidden

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

63 files changed

+538
-271
lines changed

.github/CODEOWNERS

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
# ci
55
ci/ @mroeschke
66

7-
# web
8-
web/ @datapythonista
9-
107
# docs
118
doc/cheatsheet @Dr-Irv
129
doc/source/development @noatamir

doc/source/development/contributing_gitpod.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ development experience:
109109

110110
* `VSCode rst extension <https://marketplace.visualstudio.com/items?itemName=lextudio.restructuredtext>`_
111111
* `Markdown All in One <https://marketplace.visualstudio.com/items?itemName=yzhang.markdown-all-in-one>`_
112-
* `VSCode Gitlens extension <https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens>`_
112+
* `VSCode GitLens extension <https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens>`_
113113
* `VSCode Git Graph extension <https://marketplace.visualstudio.com/items?itemName=mhutchie.git-graph>`_
114114

115115
Development workflow with Gitpod

doc/source/user_guide/merging.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,7 @@ resetting indexes.
906906
Joining multiple :class:`DataFrame`
907907
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
908908

909-
A list or tuple of ``:class:`DataFrame``` can also be passed to :meth:`~DataFrame.join`
909+
A list or tuple of :class:`DataFrame` can also be passed to :meth:`~DataFrame.join`
910910
to join them together on their indexes.
911911

912912
.. ipython:: python

doc/source/user_guide/window.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ which will first group the data by the specified keys and then perform a windowi
7070

7171
Some windowing aggregation, ``mean``, ``sum``, ``var`` and ``std`` methods may suffer from numerical
7272
imprecision due to the underlying windowing algorithms accumulating sums. When values differ
73-
with magnitude :math:`1/np.finfo(np.double).eps` this results in truncation. It must be
73+
with magnitude ``1/np.finfo(np.double).eps`` (approximately :math:`4.5 \times 10^{15}`),
74+
this results in truncation. It must be
7475
noted, that large values may have an impact on windows, which do not include these values. `Kahan summation
7576
<https://en.wikipedia.org/wiki/Kahan_summation_algorithm>`__ is used
7677
to compute the rolling sums to preserve accuracy as much as possible.

doc/source/whatsnew/v2.3.0.rst

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ Other enhancements
3737
updated to work correctly with NumPy >= 2 (:issue:`57739`)
3838
- :meth:`Series.str.decode` result now has ``StringDtype`` when ``future.infer_string`` is True (:issue:`60709`)
3939
- :meth:`~Series.to_hdf` and :meth:`~DataFrame.to_hdf` now round-trip with ``StringDtype`` (:issue:`60663`)
40-
- The :meth:`~Series.cumsum`, :meth:`~Series.cummin`, and :meth:`~Series.cummax` reductions are now implemented for ``StringDtype`` columns when backed by PyArrow (:issue:`60633`)
40+
- The :meth:`Series.str.decode` has gained the argument ``dtype`` to control the dtype of the result (:issue:`60940`)
41+
- The :meth:`~Series.cumsum`, :meth:`~Series.cummin`, and :meth:`~Series.cummax` reductions are now implemented for ``StringDtype`` columns (:issue:`60633`)
4142
- The :meth:`~Series.sum` reduction is now implemented for ``StringDtype`` columns (:issue:`59853`)
4243

4344
.. ---------------------------------------------------------------------------
@@ -53,6 +54,16 @@ These are bug fixes that might have notable behavior changes.
5354
notable_bug_fix1
5455
^^^^^^^^^^^^^^^^
5556

57+
.. _whatsnew_230.api_changes:
58+
59+
API changes
60+
~~~~~~~~~~~
61+
62+
- When enabling the ``future.infer_string`` option: Index set operations (like
63+
union or intersection) will now ignore the dtype of an empty ``RangeIndex`` or
64+
empty ``Index`` with object dtype when determining the dtype of the resulting
65+
Index (:issue:`60797`)
66+
5667
.. ---------------------------------------------------------------------------
5768
.. _whatsnew_230.deprecations:
5869

doc/source/whatsnew/v3.0.0.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ Other enhancements
7171
- :meth:`Series.str.get_dummies` now accepts a ``dtype`` parameter to specify the dtype of the resulting DataFrame (:issue:`47872`)
7272
- :meth:`pandas.concat` will raise a ``ValueError`` when ``ignore_index=True`` and ``keys`` is not ``None`` (:issue:`59274`)
7373
- :py:class:`frozenset` elements in pandas objects are now natively printed (:issue:`60690`)
74+
- Add ``"delete_rows"`` option to ``if_exists`` argument in :meth:`DataFrame.to_sql` deleting all records of the table before inserting data (:issue:`37210`).
7475
- Added half-year offset classes :class:`HalfYearBegin`, :class:`HalfYearEnd`, :class:`BHalfYearBegin` and :class:`BHalfYearEnd` (:issue:`60928`)
7576
- Errors occurring during SQL I/O will now throw a generic :class:`.DatabaseError` instead of the raw Exception type from the underlying driver manager library (:issue:`60748`)
7677
- Implemented :meth:`Series.str.isascii` and :meth:`Series.str.isascii` (:issue:`59091`)
@@ -358,10 +359,14 @@ Other API changes
358359
- Made ``dtype`` a required argument in :meth:`ExtensionArray._from_sequence_of_strings` (:issue:`56519`)
359360
- Passing a :class:`Series` input to :func:`json_normalize` will now retain the :class:`Series` :class:`Index`, previously output had a new :class:`RangeIndex` (:issue:`51452`)
360361
- Removed :meth:`Index.sort` which always raised a ``TypeError``. This attribute is not defined and will raise an ``AttributeError`` (:issue:`59283`)
362+
- Unused ``dtype`` argument has been removed from the :class:`MultiIndex` constructor (:issue:`60962`)
361363
- Updated :meth:`DataFrame.to_excel` so that the output spreadsheet has no styling. Custom styling can still be done using :meth:`Styler.to_excel` (:issue:`54154`)
362364
- pickle and HDF (``.h5``) files created with Python 2 are no longer explicitly supported (:issue:`57387`)
363365
- pickled objects from pandas version less than ``1.0.0`` are no longer supported (:issue:`57155`)
364366
- when comparing the indexes in :func:`testing.assert_series_equal`, check_exact defaults to True if an :class:`Index` is of integer dtypes. (:issue:`57386`)
367+
- Index set operations (like union or intersection) will now ignore the dtype of
368+
an empty ``RangeIndex`` or empty ``Index`` with object dtype when determining
369+
the dtype of the resulting Index (:issue:`60797`)
365370

366371
.. ---------------------------------------------------------------------------
367372
.. _whatsnew_300.deprecations:
@@ -668,6 +673,7 @@ Conversion
668673
- Bug in :meth:`DataFrame.astype` not casting ``values`` for Arrow-based dictionary dtype correctly (:issue:`58479`)
669674
- Bug in :meth:`DataFrame.update` bool dtype being converted to object (:issue:`55509`)
670675
- Bug in :meth:`Series.astype` might modify read-only array inplace when casting to a string dtype (:issue:`57212`)
676+
- Bug in :meth:`Series.convert_dtypes` and :meth:`DataFrame.convert_dtypes` removing timezone information for objects with :class:`ArrowDtype` (:issue:`60237`)
671677
- Bug in :meth:`Series.reindex` not maintaining ``float32`` type when a ``reindex`` introduces a missing value (:issue:`45857`)
672678

673679
Strings
@@ -783,6 +789,7 @@ Sparse
783789

784790
ExtensionArray
785791
^^^^^^^^^^^^^^
792+
- Bug in :class:`Categorical` when constructing with an :class:`Index` with :class:`ArrowDtype` (:issue:`60563`)
786793
- Bug in :meth:`.arrays.ArrowExtensionArray.__setitem__` which caused wrong behavior when using an integer array with repeated values as a key (:issue:`58530`)
787794
- Bug in :meth:`api.types.is_datetime64_any_dtype` where a custom :class:`ExtensionDtype` would return ``False`` for array-likes (:issue:`57055`)
788795
- Bug in comparison between object with :class:`ArrowDtype` and incompatible-dtyped (e.g. string vs bool) incorrectly raising instead of returning all-``False`` (for ``==``) or all-``True`` (for ``!=``) (:issue:`59505`)
@@ -812,6 +819,7 @@ Other
812819
- Bug in :meth:`DataFrame.transform` that was returning the wrong order unless the index was monotonically increasing. (:issue:`57069`)
813820
- Bug in :meth:`DataFrame.where` where using a non-bool type array in the function would return a ``ValueError`` instead of a ``TypeError`` (:issue:`56330`)
814821
- Bug in :meth:`Index.sort_values` when passing a key function that turns values into tuples, e.g. ``key=natsort.natsort_key``, would raise ``TypeError`` (:issue:`56081`)
822+
- Bug in :meth:`MultiIndex.fillna` error message was referring to ``isna`` instead of ``fillna`` (:issue:`60974`)
815823
- Bug in :meth:`Series.diff` allowing non-integer values for the ``periods`` argument. (:issue:`56607`)
816824
- Bug in :meth:`Series.dt` methods in :class:`ArrowDtype` that were returning incorrect values. (:issue:`57355`)
817825
- Bug in :meth:`Series.isin` raising ``TypeError`` when series is large (>10**6) and ``values`` contains NA (:issue:`60678`)

pandas/_libs/algos.pyx

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -818,33 +818,7 @@ def is_monotonic(const numeric_object_t[:] arr, bint timelike):
818818
if timelike and <int64_t>arr[0] == NPY_NAT:
819819
return False, False, False
820820

821-
if numeric_object_t is not object:
822-
with nogil:
823-
prev = arr[0]
824-
for i in range(1, n):
825-
cur = arr[i]
826-
if timelike and <int64_t>cur == NPY_NAT:
827-
is_monotonic_inc = 0
828-
is_monotonic_dec = 0
829-
break
830-
if cur < prev:
831-
is_monotonic_inc = 0
832-
elif cur > prev:
833-
is_monotonic_dec = 0
834-
elif cur == prev:
835-
is_unique = 0
836-
else:
837-
# cur or prev is NaN
838-
is_monotonic_inc = 0
839-
is_monotonic_dec = 0
840-
break
841-
if not is_monotonic_inc and not is_monotonic_dec:
842-
is_monotonic_inc = 0
843-
is_monotonic_dec = 0
844-
break
845-
prev = cur
846-
else:
847-
# object-dtype, identical to above except we cannot use `with nogil`
821+
with nogil(numeric_object_t is not object):
848822
prev = arr[0]
849823
for i in range(1, n):
850824
cur = arr[i]

pandas/_libs/hashtable_func_helper.pxi.in

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -415,20 +415,7 @@ def mode(ndarray[htfunc_t] values, bint dropna, const uint8_t[:] mask=None):
415415

416416
modes = np.empty(nkeys, dtype=values.dtype)
417417

418-
if htfunc_t is not object:
419-
with nogil:
420-
for k in range(nkeys):
421-
count = counts[k]
422-
if count == max_count:
423-
j += 1
424-
elif count > max_count:
425-
max_count = count
426-
j = 0
427-
else:
428-
continue
429-
430-
modes[j] = keys[k]
431-
else:
418+
with nogil(htfunc_t is not object):
432419
for k in range(nkeys):
433420
count = counts[k]
434421
if count == max_count:

pandas/_libs/internals.pyx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ def get_concat_blkno_indexers(list blknos_list not None):
502502
@cython.boundscheck(False)
503503
@cython.wraparound(False)
504504
def get_blkno_indexers(
505-
int64_t[:] blknos, bint group=True
505+
const int64_t[:] blknos, bint group=True
506506
) -> list[tuple[int, slice | np.ndarray]]:
507507
"""
508508
Enumerate contiguous runs of integers in ndarray.
@@ -596,8 +596,8 @@ def get_blkno_placements(blknos, group: bool = True):
596596
@cython.boundscheck(False)
597597
@cython.wraparound(False)
598598
cpdef update_blklocs_and_blknos(
599-
ndarray[intp_t, ndim=1] blklocs,
600-
ndarray[intp_t, ndim=1] blknos,
599+
const intp_t[:] blklocs,
600+
const intp_t[:] blknos,
601601
Py_ssize_t loc,
602602
intp_t nblocks,
603603
):

pandas/_libs/join.pyx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,10 @@ def full_outer_join(const intp_t[:] left, const intp_t[:] right,
225225

226226
@cython.wraparound(False)
227227
@cython.boundscheck(False)
228-
cdef void _get_result_indexer(intp_t[::1] sorter, intp_t[::1] indexer) noexcept nogil:
228+
cdef void _get_result_indexer(
229+
const intp_t[::1] sorter,
230+
intp_t[::1] indexer,
231+
) noexcept nogil:
229232
"""NOTE: overwrites indexer with the result to avoid allocating another array"""
230233
cdef:
231234
Py_ssize_t i, n, idx
@@ -681,8 +684,8 @@ def outer_join_indexer(ndarray[numeric_object_t] left, ndarray[numeric_object_t]
681684
from pandas._libs.hashtable cimport Int64HashTable
682685

683686

684-
def asof_join_backward_on_X_by_Y(ndarray[numeric_t] left_values,
685-
ndarray[numeric_t] right_values,
687+
def asof_join_backward_on_X_by_Y(const numeric_t[:] left_values,
688+
const numeric_t[:] right_values,
686689
const int64_t[:] left_by_values,
687690
const int64_t[:] right_by_values,
688691
bint allow_exact_matches=True,
@@ -752,8 +755,8 @@ def asof_join_backward_on_X_by_Y(ndarray[numeric_t] left_values,
752755
return left_indexer, right_indexer
753756

754757

755-
def asof_join_forward_on_X_by_Y(ndarray[numeric_t] left_values,
756-
ndarray[numeric_t] right_values,
758+
def asof_join_forward_on_X_by_Y(const numeric_t[:] left_values,
759+
const numeric_t[:] right_values,
757760
const int64_t[:] left_by_values,
758761
const int64_t[:] right_by_values,
759762
bint allow_exact_matches=1,
@@ -824,8 +827,8 @@ def asof_join_forward_on_X_by_Y(ndarray[numeric_t] left_values,
824827
return left_indexer, right_indexer
825828

826829

827-
def asof_join_nearest_on_X_by_Y(ndarray[numeric_t] left_values,
828-
ndarray[numeric_t] right_values,
830+
def asof_join_nearest_on_X_by_Y(const numeric_t[:] left_values,
831+
const numeric_t[:] right_values,
829832
const int64_t[:] left_by_values,
830833
const int64_t[:] right_by_values,
831834
bint allow_exact_matches=True,

0 commit comments

Comments
 (0)