Repository: pandas-dev/pandas
Pull request #60414 (2024-11-25 08:06:04)

Bump pypa/cibuildwheel from 2.21.3 to 2.22.0
Bumps [pypa/cibuildwheel](https://github.com/pypa/cibuildwheel) from 2.21.3 to 2.22.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/pypa/cibuildwheel/releases">pypa/cibuildwheel's releases</a>.</em></p>
<blockquote>
<h2>Version 2.22.0</h2>
<ul>
<li>🌟 Added a new <code>CIBW_ENABLE</code>/<code>enable</code> feature that replaces <code>CIBW_FREETHREADED_SUPPORT</code>/<code>free-threaded-support</code> and <code>CIBW_PRERELEASE_PYTHONS</code> with a system that supports both. In cibuildwheel 3, this will also include a PyPy setting and the deprecated options will be removed. (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/2048">#2048</a>)</li>
<li>🌟 <a href="https://peps.python.org/pep-0735/">Dependency groups</a> are now supported for tests. Use <code>CIBW_TEST_GROUPS</code>/<code>test-groups</code> to specify groups in <code>[dependency-groups]</code> for testing. (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/2063">#2063</a>)</li>
<li>🌟 Support for the experimental Ubuntu-based ARMv7l manylinux image (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/2052">#2052</a>)</li>
<li>✨ Show a warning when cibuildwheel is run from Python 3.10 or older; cibuildwheel 3.0 will require Python 3.11 or newer as host (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/2050">#2050</a>)</li>
<li>🐛 Fix issue with stderr interfering with checking the docker version (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/2074">#2074</a>)</li>
<li>🛠 Python 3.9 is now used in <code>CIBW_BEFORE_ALL</code>/<code>before-all</code> on linux, replacing 3.8, which is now EoL (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/2043">#2043</a>)</li>
<li>🛠 Error messages for producing a pure-Python wheel are slightly more informative (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/2044">#2044</a>)</li>
<li>🛠 Better error when <code>uname -m</code> fails on ARM (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/2049">#2049</a>)</li>
<li>🛠 Better error when repair fails and docs for abi3audit on Windows (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/2058">#2058</a>)</li>
<li>🛠 Better error when <code>manylinux-interpreters ensure</code> fails (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/2066">#2066</a>)</li>
<li>🛠 Update Pyodide to 0.26.4, and adapt to the unbundled pyodide-build (now 0.29) (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/2090">#2090</a>)</li>
<li>🛠 Now cibuildwheel uses dependency-groups for development dependencies (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/2064">#2064</a>, <a href="https://redirect.github.com/pypa/cibuildwheel/issues/2085">#2085</a>)</li>
<li>📚 Docs updates and tidy ups (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/2061">#2061</a>, <a href="https://redirect.github.com/pypa/cibuildwheel/issues/2067">#2067</a>, <a href="https://redirect.github.com/pypa/cibuildwheel/issues/2072">#2072</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/pypa/cibuildwheel/blob/main/docs/changelog.md">pypa/cibuildwheel's changelog</a>.</em></p>
<blockquote>
<h3>v2.22.0</h3>
<p><em>23 November 2024</em></p>
<ul>
<li>🌟 Added a new <code>CIBW_ENABLE</code>/<code>enable</code> feature that replaces <code>CIBW_FREETHREADED_SUPPORT</code>/<code>free-threaded-support</code> and <code>CIBW_PRERELEASE_PYTHONS</code> with a system that supports both. In cibuildwheel 3, this will also include a PyPy setting and the deprecated options will be removed. (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/2048">#2048</a>)</li>
<li>🌟 <a href="https://peps.python.org/pep-0735/">Dependency groups</a> are now supported for tests. Use <code>CIBW_TEST_GROUPS</code>/<code>test-groups</code> to specify groups in <code>[dependency-groups]</code> for testing. (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/2063">#2063</a>)</li>
<li>🌟 Support for the experimental Ubuntu-based ARMv7l manylinux image (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/2052">#2052</a>)</li>
<li>✨ Show a warning when cibuildwheel is run from Python 3.10 or older; cibuildwheel 3.0 will require Python 3.11 or newer as host (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/2050">#2050</a>)</li>
<li>🐛 Fix issue with stderr interfering with checking the docker version (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/2074">#2074</a>)</li>
<li>🛠 Python 3.9 is now used in <code>CIBW_BEFORE_ALL</code>/<code>before-all</code> on linux, replacing 3.8, which is now EoL (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/2043">#2043</a>)</li>
<li>🛠 Error messages for producing a pure-Python wheel are slightly more informative (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/2044">#2044</a>)</li>
<li>🛠 Better error when <code>uname -m</code> fails on ARM (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/2049">#2049</a>)</li>
<li>🛠 Better error when repair fails and docs for abi3audit on Windows (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/2058">#2058</a>)</li>
<li>🛠 Better error when <code>manylinux-interpreters ensure</code> fails (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/2066">#2066</a>)</li>
<li>🛠 Update Pyodide to 0.26.4, and adapt to the unbundled pyodide-build (now 0.29) (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/2090">#2090</a>)</li>
<li>🛠 Now cibuildwheel uses dependency-groups for development dependencies (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/2064">#2064</a>, <a href="https://redirect.github.com/pypa/cibuildwheel/issues/2085">#2085</a>)</li>
<li>📚 Docs updates and tidy ups (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/2061">#2061</a>, <a href="https://redirect.github.com/pypa/cibuildwheel/issues/2067">#2067</a>, <a href="https://redirect.github.com/pypa/cibuildwheel/issues/2072">#2072</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/pypa/cibuildwheel/commit/ee63bf16da6cddfb925f542f2c7b59ad50e93969"><code>ee63bf1</code></a> Bump version: v2.22.0</li>
<li><a href="https://github.com/pypa/cibuildwheel/commit/d3eeba79672a0a2eb2881d547ec1366129c236ab"><code>d3eeba7</code></a> chore: bump Ruff to 0.8.0 (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/2092">#2092</a>)</li>
<li><a href="https://github.com/pypa/cibuildwheel/commit/109020ed2d0b528335ac75cb0cf2a3ff2e25fa61"><code>109020e</code></a> Updates for Pyodide builds after <code>pyodide-build</code> was unvendored (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/2090">#2090</a>)</li>
<li><a href="https://github.com/pypa/cibuildwheel/commit/fd990007be2cc7eb1beb5501970039bf4e1dde57"><code>fd99000</code></a> [pre-commit.ci] pre-commit autoupdate (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/2087">#2087</a>)</li>
<li><a href="https://github.com/pypa/cibuildwheel/commit/e158f22d511580ea7e1c2853fdb002555c15e993"><code>e158f22</code></a> ci: update gitlab for dependency-groups (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/2089">#2089</a>)</li>
<li><a href="https://github.com/pypa/cibuildwheel/commit/8f21eb17be321024854494f69d8b45610e791c65"><code>8f21eb1</code></a> chore: use dependency-groups (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/2064">#2064</a>)</li>
<li><a href="https://github.com/pypa/cibuildwheel/commit/aac31ae2fb6f1bd1224a90f60f2e65cd419a54a3"><code>aac31ae</code></a> docs: fix update scripts usage (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/2067">#2067</a>)</li>
<li><a href="https://github.com/pypa/cibuildwheel/commit/b882b84e470860fb5fa558f32edad35e1d8f6bf1"><code>b882b84</code></a> fix: update the macOS image used on Cirrus CI (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/2085">#2085</a>)</li>
<li><a href="https://github.com/pypa/cibuildwheel/commit/243085f047937c9fe7d228bcaf0e684a64053a22"><code>243085f</code></a> [Bot] Update dependencies (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/2086">#2086</a>)</li>
<li><a href="https://github.com/pypa/cibuildwheel/commit/df6f8863900b4519a8dfee992548b11b4329d12b"><code>df6f886</code></a> feat: add manylinux armv7l (<a href="https://redirect.github.com/pypa/cibuildwheel/issues/2052">#2052</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/pypa/cibuildwheel/compare/v2.21.3...v2.22.0">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=pypa/cibuildwheel&package-manager=github_actions&previous-version=2.21.3&new-version=2.22.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>


Patch:
diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml
index 354402c572..32ca5573ac 100644
--- a/.github/workflows/wheels.yml
+++ b/.github/workflows/wheels.yml
@@ -152,7 +152,7 @@ jobs:
         run: echo "sdist_name=$(cd ./dist && ls -d */)" >> "$GITHUB_ENV"
 
       - name: Build wheels
-        uses: pypa/cibuildwheel@v2.21.3
+        uses: pypa/cibuildwheel@v2.22.0
         with:
          package-dir: ./dist/${{ startsWith(matrix.buildplat[1], 'macosx') && env.sdist_name || needs.build_sdist.outputs.sdist_file }}
         env:
diff --git a/doc/source/whatsnew/v3.0.0.rst b/doc/source/whatsnew/v3.0.0.rst
index 1d55fc3ed7..1b12735f0e 100644
--- a/doc/source/whatsnew/v3.0.0.rst
+++ b/doc/source/whatsnew/v3.0.0.rst
@@ -789,6 +789,7 @@ Other
 - Bug in :meth:`Series.dt` methods in :class:`ArrowDtype` that were returning incorrect values. (:issue:`57355`)
 - Bug in :meth:`Series.rank` that doesn't preserve missing values for nullable integers when ``na_option='keep'``. (:issue:`56976`)
 - Bug in :meth:`Series.replace` and :meth:`DataFrame.replace` inconsistently replacing matching instances when ``regex=True`` and missing values are present. (:issue:`56599`)
+- Bug in :meth:`Series.to_string` when series contains complex floats with exponents (:issue:`60405`)
 - Bug in :meth:`read_csv` where chained fsspec TAR file and ``compression="infer"`` fails with ``tarfile.ReadError`` (:issue:`60028`)
 - Bug in Dataframe Interchange Protocol implementation was returning incorrect results for data buffers' associated dtype, for string and datetime columns (:issue:`54781`)
 - Bug in ``Series.list`` methods not preserving the original :class:`Index`. (:issue:`58425`)
diff --git a/pandas/io/formats/format.py b/pandas/io/formats/format.py
index 861f5885f8..4f87b1a30c 100644
--- a/pandas/io/formats/format.py
+++ b/pandas/io/formats/format.py
@@ -1749,7 +1749,7 @@ def _trim_zeros_complex(str_complexes: ArrayLike, decimal: str = ".") -> list[st
         # The split will give [{"", "-"}, "xxx", "+/-", "xxx", "j", ""]
         # Therefore, the imaginary part is the 4th and 3rd last elements,
         # and the real part is everything before the imaginary part
-        trimmed = re.split(r"([j+-])", x)
+        trimmed = re.split(r"(?<!e)([j+-])", x)
         real_part.append("".join(trimmed[:-4]))
         imag_part.append("".join(trimmed[-4:-2]))
 


Test patch:
diff --git a/pandas/tests/io/formats/test_to_string.py b/pandas/tests/io/formats/test_to_string.py
index 5731f74a03..af3cdf2d44 100644
--- a/pandas/tests/io/formats/test_to_string.py
+++ b/pandas/tests/io/formats/test_to_string.py
@@ -422,6 +422,24 @@ class TestToStringNumericFormatting:
             )
             assert result == expected
 
+    def test_to_string_complex_float_formatting_with_exponents(self):
+        # GH #60393
+        with option_context("display.precision", 6):
+            df = DataFrame(
+                {
+                    "x": [
+                        (1.8816e-09 + 0j),
+                        (1.8816e-09 + 3.39676e-09j),
+                    ]
+                }
+            )
+            result = df.to_string()
+            expected = (
+                "                            x\n0  1.881600e-09+0.000000e+00j\n"
+                "1  1.881600e-09+3.396760e-09j"
+            )
+            assert result == expected
+
     def test_to_string_format_inf(self):
         # GH#24861
         df = DataFrame(