Skip to content

Commit 9011525

Browse files
Merge remote-tracking branch 'upstream/main' into mamba_solver_issue
2 parents cc8b072 + 6a9d50c commit 9011525

25 files changed

+91
-48
lines changed

.github/workflows/wheels.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ jobs:
9595
- [ubuntu-24.04, manylinux_x86_64]
9696
- [ubuntu-24.04, musllinux_x86_64]
9797
- [ubuntu-24.04-arm, manylinux_aarch64]
98+
- [ubuntu-24.04-arm, musllinux_aarch64]
9899
- [macos-13, macosx_x86_64]
99100
# Note: M1 images on Github Actions start from macOS 14
100101
- [macos-14, macosx_arm64]

doc/source/user_guide/reshaping.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ variables and the values representing the presence of those variables per row.
395395
pd.get_dummies(df["key"])
396396
df["key"].str.get_dummies()
397397
398-
``prefix`` adds a prefix to the the column names which is useful for merging the result
398+
``prefix`` adds a prefix to the column names which is useful for merging the result
399399
with the original :class:`DataFrame`:
400400

401401
.. ipython:: python

doc/source/user_guide/user_defined_functions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ to the original data.
319319
320320
In the example, the ``warm_up_all_days`` function computes the ``max`` like an aggregation, but instead
321321
of returning just the maximum value, it returns a ``DataFrame`` with the same shape as the original one
322-
with the values of each day replaced by the the maximum temperature of the city.
322+
with the values of each day replaced by the maximum temperature of the city.
323323

324324
``transform`` is also available for :meth:`SeriesGroupBy.transform`, :meth:`DataFrameGroupBy.transform` and
325325
:meth:`Resampler.transform`, where it's more common. You can read more about ``transform`` in groupby

doc/source/whatsnew/v1.1.0.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1039,7 +1039,7 @@ Missing
10391039
^^^^^^^
10401040
- Calling :meth:`fillna` on an empty :class:`Series` now correctly returns a shallow copied object. The behaviour is now consistent with :class:`Index`, :class:`DataFrame` and a non-empty :class:`Series` (:issue:`32543`).
10411041
- Bug in :meth:`Series.replace` when argument ``to_replace`` is of type dict/list and is used on a :class:`Series` containing ``<NA>`` was raising a ``TypeError``. The method now handles this by ignoring ``<NA>`` values when doing the comparison for the replacement (:issue:`32621`)
1042-
- Bug in :meth:`~Series.any` and :meth:`~Series.all` incorrectly returning ``<NA>`` for all ``False`` or all ``True`` values using the nulllable Boolean dtype and with ``skipna=False`` (:issue:`33253`)
1042+
- Bug in :meth:`~Series.any` and :meth:`~Series.all` incorrectly returning ``<NA>`` for all ``False`` or all ``True`` values using the nullable Boolean dtype and with ``skipna=False`` (:issue:`33253`)
10431043
- Clarified documentation on interpolate with ``method=akima``. The ``der`` parameter must be scalar or ``None`` (:issue:`33426`)
10441044
- :meth:`DataFrame.interpolate` uses the correct axis convention now. Previously interpolating along columns lead to interpolation along indices and vice versa. Furthermore interpolating with methods ``pad``, ``ffill``, ``bfill`` and ``backfill`` are identical to using these methods with :meth:`DataFrame.fillna` (:issue:`12918`, :issue:`29146`)
10451045
- Bug in :meth:`DataFrame.interpolate` when called on a :class:`DataFrame` with column names of string type was throwing a ValueError. The method is now independent of the type of the column names (:issue:`33956`)

doc/source/whatsnew/v3.0.0.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@ Groupby/resample/rolling
833833
- Bug in :meth:`DataFrameGroupby.transform` and :meth:`SeriesGroupby.transform` with a reducer and ``observed=False`` that coerces dtype to float when there are unobserved categories. (:issue:`55326`)
834834
- Bug in :meth:`Rolling.apply` for ``method="table"`` where column order was not being respected due to the columns getting sorted by default. (:issue:`59666`)
835835
- Bug in :meth:`Rolling.apply` where the applied function could be called on fewer than ``min_period`` periods if ``method="table"``. (:issue:`58868`)
836-
- Bug in :meth:`Series.resample` could raise when the the date range ended shortly before a non-existent time. (:issue:`58380`)
836+
- Bug in :meth:`Series.resample` could raise when the date range ended shortly before a non-existent time. (:issue:`58380`)
837837

838838
Reshaping
839839
^^^^^^^^^
@@ -851,6 +851,7 @@ Reshaping
851851
- Bug in :meth:`DataFrame.unstack` producing incorrect results when manipulating empty :class:`DataFrame` with an :class:`ExtentionDtype` (:issue:`59123`)
852852
- Bug in :meth:`concat` where concatenating DataFrame and Series with ``ignore_index = True`` drops the series name (:issue:`60723`, :issue:`56257`)
853853
- Bug in :func:`melt` where calling with duplicate column names in ``id_vars`` raised a misleading ``AttributeError`` (:issue:`61475`)
854+
- Bug in :meth:`DataFrame.merge` where user-provided suffixes could result in duplicate column names if the resulting names matched existing columns. Now raises a :class:`MergeError` in such cases. (:issue:`61402`)
854855

855856
Sparse
856857
^^^^^^

meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ if cy.version().version_compare('>=3.1.0')
5757
command: [
5858
cy,
5959
'-3',
60+
'-Xfreethreading_compatible=true',
6061
'--fast-fail',
6162
'--generate-shared=' + meson.current_build_dir() / '_cyutility.c',
6263
],

pandas/_libs/tslibs/conversion.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,7 @@ cdef int64_t parse_pydatetime(
797797
dts : *npy_datetimestruct
798798
Needed to use in pydatetime_to_dt64, which writes to it.
799799
creso : NPY_DATETIMEUNIT
800-
Resolution to store the the result.
800+
Resolution to store the result.
801801
802802
Raises
803803
------

pandas/core/arrays/categorical.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1666,7 +1666,7 @@ def __array__(
16661666
Parameters
16671667
----------
16681668
dtype : np.dtype or None
1669-
Specifies the the dtype for the array.
1669+
Specifies the dtype for the array.
16701670
16711671
copy : bool or None, optional
16721672
See :func:`numpy.asarray`.

pandas/core/reshape/merge.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3062,13 +3062,16 @@ def renamer(x, suffix: str | None):
30623062
if not llabels.is_unique:
30633063
# Only warn when duplicates are caused because of suffixes, already duplicated
30643064
# columns in origin should not warn
3065-
dups = llabels[(llabels.duplicated()) & (~left.duplicated())].tolist()
3065+
dups.extend(llabels[(llabels.duplicated()) & (~left.duplicated())].tolist())
30663066
if not rlabels.is_unique:
30673067
dups.extend(rlabels[(rlabels.duplicated()) & (~right.duplicated())].tolist())
3068+
# Suffix addition creates duplicate to pre-existing column name
3069+
dups.extend(llabels.intersection(right.difference(to_rename)).tolist())
3070+
dups.extend(rlabels.intersection(left.difference(to_rename)).tolist())
30683071
if dups:
30693072
raise MergeError(
30703073
f"Passing 'suffixes' which cause duplicate columns {set(dups)} is "
3071-
f"not allowed.",
3074+
"not allowed.",
30723075
)
30733076

30743077
return llabels, rlabels

pandas/io/formats/format.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
columns : array-like, optional, default None
115115
The subset of columns to write. Writes all columns by default.
116116
col_space : %(col_space_type)s, optional
117-
%(col_space)s.
117+
%(col_space)s
118118
header : %(header_type)s, optional
119119
%(header)s.
120120
index : bool, optional, default True

pandas/tests/io/xml/test_to_xml.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1345,7 +1345,7 @@ def test_ea_dtypes(any_numeric_ea_dtype, parser):
13451345
assert equalize_decl(result).strip() == expected
13461346

13471347

1348-
def test_unsuported_compression(parser, geom_df):
1348+
def test_unsupported_compression(parser, geom_df):
13491349
with pytest.raises(ValueError, match="Unrecognized compression type"):
13501350
with tm.ensure_clean() as path:
13511351
geom_df.to_xml(path, parser=parser, compression="7z")

pandas/tests/io/xml/test_xml.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1961,7 +1961,7 @@ def test_wrong_compression(parser, compression, compression_only):
19611961
read_xml(path, parser=parser, compression=attempted_compression)
19621962

19631963

1964-
def test_unsuported_compression(parser):
1964+
def test_unsupported_compression(parser):
19651965
with pytest.raises(ValueError, match="Unrecognized compression type"):
19661966
with tm.ensure_clean() as path:
19671967
read_xml(path, parser=parser, compression="7z")

pandas/tests/reshape/merge/test_merge.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3060,3 +3060,12 @@ def test_merge_on_all_nan_column():
30603060
{"x": [1, 2, 3], "y": [np.nan, np.nan, np.nan], "z": [4, 5, 6], "zz": [4, 5, 6]}
30613061
)
30623062
tm.assert_frame_equal(result, expected)
3063+
3064+
3065+
@pytest.mark.parametrize("suffixes", [("_dup", ""), ("", "_dup")])
3066+
def test_merge_for_suffix_collisions(suffixes):
3067+
# GH#61402
3068+
df1 = DataFrame({"col1": [1], "col2": [2]})
3069+
df2 = DataFrame({"col1": [1], "col2": [2], "col2_dup": [3]})
3070+
with pytest.raises(MergeError, match="duplicate columns"):
3071+
merge(df1, df2, on="col1", suffixes=suffixes)

web/pandas/pdeps/0001-purpose-and-guidelines.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
[Noa Tamir](https://github.com/noatamir)
99
- Revision: 3
1010

11+
[TOC]
12+
1113
## PDEP definition, purpose and scope
1214

1315
A PDEP (pandas enhancement proposal) is a proposal for a **major** change in

web/pandas/pdeps/0004-consistent-to-datetime-parsing.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
- Author: [Marco Gorelli](https://github.com/MarcoGorelli)
77
- Revision: 2
88

9+
[TOC]
10+
911
## Abstract
1012

1113
The suggestion is that:

web/pandas/pdeps/0005-no-default-index-mode.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
- Author: [Marco Gorelli](https://github.com/MarcoGorelli)
77
- Revision: 2
88

9+
[TOC]
10+
911
## Abstract
1012

1113
The suggestion is to add a ``NoRowIndex`` class. Internally, it would act a bit like

web/pandas/pdeps/0006-ban-upcasting.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
- Author: [Marco Gorelli](https://github.com/MarcoGorelli) ([original issue](https://github.com/pandas-dev/pandas/issues/39584) by [Joris Van den Bossche](https://github.com/jorisvandenbossche))
77
- Revision: 1
88

9+
[TOC]
10+
911
## Abstract
1012

1113
The suggestion is that setitem-like operations would

web/pandas/pdeps/0007-copy-on-write.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
- Author: [Joris Van den Bossche](https://github.com/jorisvandenbossche)
77
- Revision: 1
88

9+
[TOC]
10+
911
## Abstract
1012

1113
Short summary of the proposal:
@@ -525,7 +527,7 @@ following cases:
525527
* Selecting a single column (as a Series) out of a DataFrame is always a view
526528
(``df['a']``)
527529
* Slicing columns from a DataFrame creating a subset DataFrame (``df[['a':'b']]`` or
528-
``df.loc[:, 'a': 'b']``) is a view _if_ the the original DataFrame consists of a
530+
``df.loc[:, 'a': 'b']``) is a view _if_ the original DataFrame consists of a
529531
single block (single dtype, consolidated) and _if_ you are slicing (so not a list
530532
selection). In all other cases, getting a subset is always a copy.
531533
* Selecting rows _can_ return a view, when the row indexer is a `slice` object.

web/pandas/pdeps/0009-io-extensions.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
- Author: [Marc Garcia](https://github.com/datapythonista)
88
- Revision: 1
99

10+
[TOC]
11+
1012
## PDEP Summary
1113

1214
This document proposes that third-party projects implementing I/O or memory

web/pandas/pdeps/0010-required-pyarrow-dependency.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
[Patrick Hoefler](https://github.com/phofl)
99
- Revision: 1
1010

11+
[TOC]
12+
1113
## Abstract
1214

1315
This PDEP proposes that:

web/pandas/pdeps/0012-compact-and-reversible-JSON-interface.md

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,36 +8,7 @@
88
- Author: [Philippe THOMY](https://github.com/loco-philippe)
99
- Revision: 3
1010

11-
##### Summary
12-
13-
- [Abstract](./0012-compact-and-reversible-JSON-interface.md/#Abstract)
14-
- [Problem description](./0012-compact-and-reversible-JSON-interface.md/#Problem-description)
15-
- [Feature Description](./0012-compact-and-reversible-JSON-interface.md/#Feature-Description)
16-
- [Scope](./0012-compact-and-reversible-JSON-interface.md/#Scope)
17-
- [Motivation](./0012-compact-and-reversible-JSON-interface.md/#Motivation)
18-
- [Why is it important to have a compact and reversible JSON interface ?](./0012-compact-and-reversible-JSON-interface.md/#Why-is-it-important-to-have-a-compact-and-reversible-JSON-interface-?)
19-
- [Is it relevant to take an extended type into account ?](./0012-compact-and-reversible-JSON-interface.md/#Is-it-relevant-to-take-an-extended-type-into-account-?)
20-
- [Is this only useful for pandas ?](./0012-compact-and-reversible-JSON-interface.md/#Is-this-only-useful-for-pandas-?)
21-
- [Description](./0012-compact-and-reversible-JSON-interface.md/#Description)
22-
- [Data typing](./0012-compact-and-reversible-JSON-interface.md/#Data-typing)
23-
- [Correspondence between TableSchema and pandas](./panda0012-compact-and-reversible-JSON-interfaces_PDEP.md/#Correspondence-between-TableSchema-and-pandas)
24-
- [JSON format](./0012-compact-and-reversible-JSON-interface.md/#JSON-format)
25-
- [Conversion](./0012-compact-and-reversible-JSON-interface.md/#Conversion)
26-
- [Usage and impact](./0012-compact-and-reversible-JSON-interface.md/#Usage-and-impact)
27-
- [Usage](./0012-compact-and-reversible-JSON-interface.md/#Usage)
28-
- [Compatibility](./0012-compact-and-reversible-JSON-interface.md/#Compatibility)
29-
- [Impacts on the pandas framework](./0012-compact-and-reversible-JSON-interface.md/#Impacts-on-the-pandas-framework)
30-
- [Risk to do / risk not to do](./0012-compact-and-reversible-JSON-interface.md/#Risk-to-do-/-risk-not-to-do)
31-
- [Implementation](./0012-compact-and-reversible-JSON-interface.md/#Implementation)
32-
- [Modules](./0012-compact-and-reversible-JSON-interface.md/#Modules)
33-
- [Implementation options](./0012-compact-and-reversible-JSON-interface.md/#Implementation-options)
34-
- [F.A.Q.](./0012-compact-and-reversible-JSON-interface.md/#F.A.Q.)
35-
- [Synthesis](./0012-compact-and-reversible-JSON-interface.md/Synthesis)
36-
- [Core team decision](./0012-compact-and-reversible-JSON-interface.md/#Core-team-decision)
37-
- [Timeline](./0012-compact-and-reversible-JSON-interface.md/#Timeline)
38-
- [PDEP history](./0012-compact-and-reversible-JSON-interface.md/#PDEP-history)
39-
40-
-------------------------
11+
[TOC]
4112

4213
## Abstract
4314

web/pandas/pdeps/0014-string-dtype.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,8 @@ in pandas 2.3 and removed in pandas 3.0.
220220

221221
The `storage` keyword of `StringDtype` is kept to disambiguate the underlying
222222
storage of the string data (using pyarrow or python objects), but an additional
223-
`na_value` is introduced to disambiguate the the variants using NA semantics
224-
and NaN semantics.
223+
`na_value` is introduced to disambiguate the variants using NA semantics and
224+
NaN semantics.
225225

226226
Overview of the different ways to specify a dtype and the resulting concrete
227227
dtype of the data:

web/pandas/static/css/pandas.css

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
html {
2+
scroll-padding-top: 5rem;
3+
}
14
body {
25
padding-top: 5em;
36
color: #444;
@@ -103,3 +106,23 @@ blockquote {
103106
color: #787878;
104107
font-size: 18px;
105108
}
109+
110+
.toc {
111+
background: #f0f0f0;
112+
padding: 10px;
113+
display: inline-block;
114+
}
115+
a.headerlink {
116+
opacity: 0;
117+
}
118+
h2:hover a.headerlink {
119+
opacity: 1;
120+
transition: opacity 0.5s;
121+
}
122+
h3:hover a.headerlink {
123+
opacity: 1;
124+
transition: opacity 0.5s;
125+
}
126+
.container {
127+
max-width: 100ch;
128+
}

web/pandas/versions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
{
1414
"name": "2.2",
1515
"version": "2.2",
16-
"url": "https://pandas.pydata.org/pandas-docs/version/2.2/",
16+
"url": "https://pandas.pydata.org/pandas-docs/version/2.2/"
1717
},
1818
{
1919
"name": "2.1",

web/pandas_web.py

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -466,9 +466,29 @@ def main(
466466
with open(os.path.join(source_path, fname), encoding="utf-8") as f:
467467
content = f.read()
468468
if extension == ".md":
469-
body = markdown.markdown(
470-
content, extensions=context["main"]["markdown_extensions"]
471-
)
469+
if "pdeps/" in fname:
470+
from markdown.extensions.toc import TocExtension
471+
472+
body = markdown.markdown(
473+
content,
474+
extensions=[
475+
# Ignore the title of the PDEP in the table of contents
476+
TocExtension(
477+
title="Table of Contents",
478+
toc_depth="2-3",
479+
permalink=" #",
480+
),
481+
"tables",
482+
"fenced_code",
483+
"meta",
484+
"footnotes",
485+
"codehilite",
486+
],
487+
)
488+
else:
489+
body = markdown.markdown(
490+
content, extensions=context["main"]["markdown_extensions"]
491+
)
472492
# Apply Bootstrap's table formatting manually
473493
# Python-Markdown doesn't let us config table attributes by hand
474494
body = body.replace("<table>", '<table class="table table-bordered">')

0 commit comments

Comments
 (0)