Skip to content

GH-48808: [Python] Drop support for Pandas < 2.0.3#50444

Merged
pitrou merged 8 commits into
apache:mainfrom
raulcd:GH-48808
Jul 9, 2026
Merged

GH-48808: [Python] Drop support for Pandas < 2.0.3#50444
pitrou merged 8 commits into
apache:mainfrom
raulcd:GH-48808

Conversation

@raulcd

@raulcd raulcd commented Jul 9, 2026

Copy link
Copy Markdown
Member

Rationale for this change

Pandas 2.0.0 was released on April 3rd 2023.
The last version of Pandas 1 was Pandas 1.5.3 and it was released on January 19th 2023. That version only supports up to Python 3.11.

We are currently supporting up to Pandas 1.5.2 (first version supporting 3.11).

On the issue we discussed to bump our Pandas support to 2.0.0 but given 2.0.3 is the latest in the 2.0.x, was released on June 2023, only supports up to Python 3.11 and bumping to it allows use to improve even further some of the conditionals we are bumping to Pandas >= 2.0.3

What changes are included in this PR?

Update minimal support check to Version(2.0.3) and remove all test skips, conditionals and scenarios where we are checking for Pandas < 2.0.3.

We found a couple of minor things

Are these changes tested?

Yes via CI

Are there any user-facing changes?

Yes, Pandas < 2 won't be supported.

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

⚠️ GitHub issue #48808 has been automatically assigned in GitHub to PR creator.

@raulcd raulcd changed the title GH-48808: [Python] Investigate what entails bumping pandas >=2 GH-48808: [Python] Drop support for Pandas < 2.0.0 Jul 9, 2026
@raulcd

raulcd commented Jul 9, 2026

Copy link
Copy Markdown
Member Author

@github-actions crossbow submit -g python

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

Revision: e2ae2d8

Submitted crossbow builds: ursacomputing/crossbow @ actions-e1266493a7

Task Status
example-python-minimal-build-fedora-conda GitHub Actions
example-python-minimal-build-ubuntu-venv GitHub Actions
test-conda-python-3.11 GitHub Actions
test-conda-python-3.11-dask-latest GitHub Actions
test-conda-python-3.11-dask-upstream_devel GitHub Actions
test-conda-python-3.11-hdfs-2.9.2 GitHub Actions
test-conda-python-3.11-hdfs-3.2.1 GitHub Actions
test-conda-python-3.11-hypothesis GitHub Actions
test-conda-python-3.11-pandas-2.0.0-numpy-1.23.2 GitHub Actions
test-conda-python-3.11-spark-master GitHub Actions
test-conda-python-3.12 GitHub Actions
test-conda-python-3.12-pandas-latest-numpy-latest GitHub Actions
test-conda-python-3.13 GitHub Actions
test-conda-python-3.13-pandas-latest-numpy-1.26.2 GitHub Actions
test-conda-python-3.13-pandas-latest-numpy-latest GitHub Actions
test-conda-python-3.14 GitHub Actions
test-conda-python-3.14-cpython-debug GitHub Actions
test-conda-python-3.14-pandas-nightly-numpy-nightly GitHub Actions
test-conda-python-3.14-pandas-upstream_devel-numpy-nightly GitHub Actions
test-conda-python-emscripten GitHub Actions
test-debian-13-python-3-amd64 GitHub Actions
test-debian-13-python-3-i386 GitHub Actions
test-fedora-42-python-3 GitHub Actions
test-ubuntu-24.04-python-3 GitHub Actions

@raulcd

raulcd commented Jul 9, 2026

Copy link
Copy Markdown
Member Author

@github-actions crossbow submit test-conda-python-3.11-pandas-2.0.0-numpy-1.23.2

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

Revision: 419d344

Submitted crossbow builds: ursacomputing/crossbow @ actions-40780d2205

Task Status
test-conda-python-3.11-pandas-2.0.0-numpy-1.23.2 GitHub Actions

@raulcd raulcd marked this pull request as ready for review July 9, 2026 13:18
Copilot AI review requested due to automatic review settings July 9, 2026 13:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates PyArrow’s Python/Pandas integration to drop support for pandas versions older than 2.0.0 by raising the minimum-version gate in the pandas shim, removing legacy version conditionals/skips throughout the test suite, and updating CI/docs to reflect the new baseline.

Changes:

  • Enforce pandas >= 2.0.0 in the pandas import shim and update the documented minimum pandas version.
  • Remove pandas<2-specific coercion paths and version-conditional logic across pandas-related conversions/tests.
  • Update CI task matrices to run the pinned “minimum pandas” job against pandas 2.0.0 instead of 1.5.2.

Reviewed changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
python/pyarrow/types.pxi Removes pandas-v1-specific temporal coercion from dtype mapping logic.
python/pyarrow/tests/test_schema.py Drops pandas-version branching in dtype expectations.
python/pyarrow/tests/test_pandas.py Removes numerous pandas<2 code paths/skips and updates expectations for non-ns units.
python/pyarrow/tests/test_compute.py Removes old pandas<1.1 conditional for isocalendar extraction (always uses modern path).
python/pyarrow/tests/parquet/test_pandas.py Removes skip for pandas versions below a now-unsupported threshold.
python/pyarrow/tests/interchange/test_conversion.py Removes pandas<2-era skips/expected-behavior branching for interchange tests.
python/pyarrow/table.pxi Removes pandas-v1 default that forced temporal nanosecond coercion.
python/pyarrow/src/arrow/python/arrow_to_pandas.cc Minor comment whitespace fix.
python/pyarrow/pandas-shim.pxi Raises minimum supported pandas version check to 2.0.0 and removes is_v1.
python/pyarrow/pandas_compat.py Stops forcing datetimetz unit to ns for pandas v1.
python/pyarrow/array.pxi Removes pandas-v1 default that forced temporal nanosecond coercion for array-like conversions.
docs/source/python/install.rst Updates documented optional dependency minimum to pandas 2.0.0.
dev/tasks/tasks.yml Updates the “minimum pandas” integration-test entry to pandas 2.0.0.
.github/workflows/python.yml Updates the pinned CI job from pandas 1.5.2 to pandas 2.0.0 (and renames job label accordingly).

Comment thread python/pyarrow/tests/test_pandas.py Outdated
@github-actions github-actions Bot added awaiting changes Awaiting changes and removed awaiting committer review Awaiting committer review labels Jul 9, 2026
Comment thread .github/workflows/python.yml Outdated
// DateOffset objects do not add nanoseconds component to pd.Timestamp.
// as of Pandas 1.3.3
// as of Pandas 1.3.3
// (https://github.com/pandas-dev/pandas/issues/43892).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like pandas-dev/pandas#43892 was fixed in 1.4, can this piece of code be simplified? (though I have no idea how :))

@raulcd raulcd Jul 9, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it could be simplified to something like:

diff --git a/python/pyarrow/src/arrow/python/arrow_to_pandas.cc b/python/pyarrow/src/arrow/python/arrow_to_pandas.cc
index 348d352a04..581da12577 100644
--- a/python/pyarrow/src/arrow/python/arrow_to_pandas.cc
+++ b/python/pyarrow/src/arrow/python/arrow_to_pandas.cc
@@ -1292,24 +1292,10 @@ struct ObjectWriterVisitor {
     auto to_date_offset = [&](const MonthDayNanoIntervalType::MonthDayNanos& interval,
                               PyObject** out) {
       ARROW_DCHECK(internal::BorrowPandasDataOffsetType() != nullptr);
-      // DateOffset objects do not add nanoseconds component to pd.Timestamp.
-      // as of Pandas 1.3.3
-      // (https://github.com/pandas-dev/pandas/issues/43892).
-      // So convert microseconds and remainder to preserve data
-      // but give users more expected results.
-      int64_t microseconds = interval.nanoseconds / 1000;
-      int64_t nanoseconds;
-      if (interval.nanoseconds >= 0) {
-        nanoseconds = interval.nanoseconds % 1000;
-      } else {
-        nanoseconds = -((-interval.nanoseconds) % 1000);
-      }
 
       PyDict_SetItemString(kwargs.obj(), "months", PyLong_FromLong(interval.months));
       PyDict_SetItemString(kwargs.obj(), "days", PyLong_FromLong(interval.days));
-      PyDict_SetItemString(kwargs.obj(), "microseconds",
-                           PyLong_FromLongLong(microseconds));
-      PyDict_SetItemString(kwargs.obj(), "nanoseconds", PyLong_FromLongLong(nanoseconds));
+      PyDict_SetItemString(kwargs.obj(), "nanoseconds", PyLong_FromLongLong(interval.nanoseconds));
       *out =
           PyObject_Call(internal::BorrowPandasDataOffsetType(), args.obj(), kwargs.obj());
       RETURN_IF_PYERROR();

but I think this is a small change on the UX, nowadays we don't roundtrip hours/minutes on DateOffset we show microseconds and nanoseconds. With this change we will be consistent and we would show, Month/Day/Nano instead of Month/Day/Microseconds/Nano. I think this is worth it but maybe we should do it as a separate issue from this one around dropping older pandas supprt and discuss there whether the UX change is worth?
Are you ok if I move this to its own issue?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's ok to me. Also should probably ping @jorisvandenbossche for advice :)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread dev/tasks/tasks.yml Outdated
Copilot AI review requested due to automatic review settings July 9, 2026 14:24
@raulcd raulcd changed the title GH-48808: [Python] Drop support for Pandas < 2.0.0 GH-48808: [Python] Drop support for Pandas < 2.0.3 Jul 9, 2026
@github-actions github-actions Bot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Jul 9, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 14 changed files in this pull request and generated 1 comment.

Comment thread python/pyarrow/types.pxi
Copilot AI review requested due to automatic review settings July 9, 2026 14:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 14 changed files in this pull request and generated no new comments.

@raulcd

raulcd commented Jul 9, 2026

Copy link
Copy Markdown
Member Author

@github-actions crossbow submit test-conda-python-3.11-pandas-2*

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

Revision: 5dad2a2

Submitted crossbow builds: ursacomputing/crossbow @ actions-8ccbf18024

Task Status
test-conda-python-3.11-pandas-2.0.3-numpy-1.23.2 GitHub Actions

@pitrou

pitrou commented Jul 9, 2026

Copy link
Copy Markdown
Member

@github-actions crossbow submit pandas

@pitrou

pitrou commented Jul 9, 2026

Copy link
Copy Markdown
Member

Let's ensure that all Pandas-enabling builds pass before merging.

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

Revision: 5dad2a2

Submitted crossbow builds: ursacomputing/crossbow @ actions-9768a39d8c

Task Status
test-conda-python-3.11-pandas-2.0.3-numpy-1.23.2 GitHub Actions
test-conda-python-3.12-pandas-latest-numpy-latest GitHub Actions
test-conda-python-3.13-pandas-latest-numpy-1.26.2 GitHub Actions
test-conda-python-3.13-pandas-latest-numpy-latest GitHub Actions
test-conda-python-3.14-pandas-nightly-numpy-nightly GitHub Actions
test-conda-python-3.14-pandas-upstream_devel-numpy-nightly GitHub Actions

@pitrou pitrou merged commit b0b792a into apache:main Jul 9, 2026
48 of 49 checks passed
@pitrou pitrou removed the awaiting change review Awaiting change review label Jul 9, 2026
@github-actions github-actions Bot added the awaiting changes Awaiting changes label Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants