Skip to content

Commit a7955da

Browse files
committed
Merge branch 'main' into api-dt-ints
2 parents a5d7e51 + b95f65b commit a7955da

File tree

70 files changed

+1075
-511
lines changed

Some content is hidden

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

70 files changed

+1075
-511
lines changed

.github/workflows/docbuild-and-upload.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ jobs:
9393
run: mv doc/build/html web/build/docs
9494

9595
- name: Save website as an artifact
96-
uses: actions/upload-artifact@v5
96+
uses: actions/upload-artifact@v6
9797
with:
9898
name: website
9999
path: web/build

.github/workflows/unit-tests.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ jobs:
3131
# Prevent the include jobs from overriding other jobs
3232
pattern: [""]
3333
pandas_future_infer_string: ["1"]
34+
pandas_future_python_scalars: ["0"]
3435
include:
3536
- name: "Downstream Compat"
3637
env_file: actions-313-downstream_compat.yaml
@@ -75,6 +76,10 @@ jobs:
7576
env_file: actions-313.yaml
7677
pandas_future_infer_string: "0"
7778
platform: ubuntu-24.04
79+
- name: "PANDAS_FUTURE_PYTHON_SCALARS=1"
80+
env_file: actions-313.yaml
81+
pandas_future_python_scalars: "1"
82+
platform: ubuntu-24.04
7883
- name: "Numpy Dev"
7984
env_file: actions-313-numpydev.yaml
8085
pattern: "not slow and not network and not single_cpu"
@@ -92,6 +97,7 @@ jobs:
9297
LC_ALL: ${{ matrix.lc_all || '' }}
9398
PANDAS_CI: '1'
9499
PANDAS_FUTURE_INFER_STRING: ${{ matrix.pandas_future_infer_string || '1' }}
100+
PANDAS_FUTURE_PYTHON_SCALARS: ${{ matrix.pandas_future_python_scalars || '0' }}
95101
TEST_ARGS: ${{ matrix.test_args || '' }}
96102
PYTEST_WORKERS: 'auto'
97103
PYTEST_TARGET: ${{ matrix.pytest_target || 'pandas' }}

.github/workflows/wheels.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
python -m pip install build
6565
python -m build --sdist
6666
67-
- uses: actions/upload-artifact@v5
67+
- uses: actions/upload-artifact@v6
6868
with:
6969
name: sdist
7070
path: ./dist/*
@@ -138,7 +138,7 @@ jobs:
138138
# removes unnecessary files from the release
139139
- name: Download sdist (not macOS)
140140
#if: ${{ matrix.buildplat[1] != 'macosx_*' }}
141-
uses: actions/download-artifact@v6
141+
uses: actions/download-artifact@v7
142142
with:
143143
name: sdist
144144
path: ./dist
@@ -197,7 +197,7 @@ jobs:
197197
shell: bash -el {0}
198198
run: for whl in $(ls ./dist/*.whl); do wheel unpack $whl -d /tmp; done
199199

200-
- uses: actions/upload-artifact@v5
200+
- uses: actions/upload-artifact@v6
201201
with:
202202
name: ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }}
203203
path: ./dist/*.whl
@@ -229,11 +229,11 @@ jobs:
229229

230230
steps:
231231
- name: Download all artefacts
232-
uses: actions/download-artifact@v6
232+
uses: actions/download-artifact@v7
233233
with:
234234
path: dist # everything lands in ./dist/**
235235

236-
# TODO: This step can be probably be achieved by actions/download-artifact@v6
236+
# TODO: This step can be probably be achieved by actions/download-artifact@v7
237237
# by specifying merge-multiple: true, and a glob pattern
238238
- name: Collect files
239239
run: |
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Announcement: pandas 3.0.0 release candidate ready for testing! Read more <a href="https://pandas.pydata.org/community/blog/pandas-3.0-release-candidate.html">in the blog post</a>

doc/source/_static/schemas/01_table_dataframe.svg

Lines changed: 48 additions & 262 deletions
Loading

doc/source/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@
258258
# This shows a warning for patch releases since the
259259
# patch version doesn't compare as equal (e.g. 2.2.1 != 2.2.0 but it should be)
260260
"show_version_warning_banner": False,
261+
"announcement": "https://raw.githubusercontent.com/pandas-dev/pandas/main/doc/_templates/docs-announcement-banner.html",
261262
"icon_links": [
262263
{
263264
"name": "X",

doc/source/getting_started/intro_tutorials/01_table_oriented.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ SQL table or the ``data.frame`` in `R <https://www.r-project.org/>`__.
7272
- The column ``Name`` consists of textual data with each value a
7373
string, the column ``Age`` are numbers and the column ``Sex`` is
7474
textual data.
75+
- The index labels each row. By default, this is a sequence of integers
76+
starting at 0.
7577

7678
In spreadsheet software, the table representation of our data would look
7779
very similar:

doc/source/whatsnew/v3.0.0.rst

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ and how to adapt your code to the new default.
8080

8181
.. _whatsnew_300.enhancements.copy_on_write:
8282

83-
Copy-on-Write
84-
^^^^^^^^^^^^^
83+
Consistent copy/view behaviour with Copy-on-Write
84+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
8585

8686
The new "copy-on-write" behaviour in pandas 3.0 brings changes in behavior in
8787
how pandas operates with respect to copies and views. A summary of the changes:
@@ -101,9 +101,10 @@ copy or a view depended on the exact operation performed, which was often
101101
confusing).
102102

103103
Because every single indexing step now behaves as a copy, this also means that
104-
"chained assignment" (updating a DataFrame with multiple setitem steps) will
105-
stop working. Because this now consistently never works, the
106-
``SettingWithCopyWarning`` is removed.
104+
**"chained assignment"** (updating a DataFrame with multiple setitem steps)
105+
**will stop working**. Because this now consistently never works, the
106+
``SettingWithCopyWarning`` is removed, and defensive ``.copy()`` calls to
107+
silence the warning are no longer needed.
107108

108109
The new behavioral semantics are explained in more detail in the
109110
:ref:`user guide about Copy-on-Write <copy_on_write>`.
@@ -130,10 +131,18 @@ and will be removed in pandas 4.0.
130131

131132
.. _whatsnew_300.enhancements.col:
132133

133-
``pd.col`` syntax can now be used in :meth:`DataFrame.assign` and :meth:`DataFrame.loc`
134-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
134+
Initial support for ``pd.col()`` syntax to create expressions
135+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
135136

136-
You can now use ``pd.col`` to create callables for use in dataframe methods which accept them. For example, if you have a dataframe
137+
This release introduces :func:`col` to refer to a DataFrame column by name
138+
and build up expressions.
139+
140+
This can be used as a simplified syntax to create callables for use in
141+
methods such as :meth:`DataFrame.assign`. In practice, where you would
142+
have to use a ``lambda`` function before, you can now use ``pd.col()``
143+
instead.
144+
145+
For example, if you have a dataframe
137146

138147
.. ipython:: python
139148
@@ -151,6 +160,18 @@ you can now write:
151160
152161
df.assign(c = pd.col('a') + pd.col('b'))
153162
163+
The expression object returned by :func:`col` supports all standard operators
164+
(like ``+``, ``-``, ``*``, ``/``, etc.) and all Series methods and namespaces
165+
(like ``pd.col("name").sum()``, ``pd.col("name").str.upper()``, etc.).
166+
167+
Currently, the ``pd.col()`` syntax can be used in any place which accepts a
168+
callable that takes the calling DataFrame as first argument and returns a
169+
Series, like ``lambda df: df[col_name]``.
170+
This includes :meth:`DataFrame.assign`, :meth:`DataFrame.loc`, and getitem/setitem.
171+
172+
It is expected that the support for ``pd.col()`` will be expanded to more methods
173+
in future releases.
174+
154175
New Deprecation Policy
155176
^^^^^^^^^^^^^^^^^^^^^^
156177
pandas 3.0.0 introduces a new 3-stage deprecation policy: using ``DeprecationWarning`` initially, then switching to ``FutureWarning`` for broader visibility in the last minor version before the next major release, and then removal of the deprecated functionality in the major release. This was done to give downstream packages more time to adjust to pandas deprecations, which should reduce the amount of warnings that a user gets from code that isn't theirs. See `PDEP 17 <https://pandas.pydata.org/pdeps/0017-backwards-compatibility-and-deprecation-policy.html>`_ for more details.
@@ -1139,6 +1160,7 @@ Timedelta
11391160
- Accuracy improvement in :meth:`Timedelta.to_pytimedelta` to round microseconds consistently for large nanosecond based Timedelta (:issue:`57841`)
11401161
- Bug in :class:`Timedelta` constructor failing to raise when passed an invalid keyword (:issue:`53801`)
11411162
- Bug in :meth:`DataFrame.cumsum` which was raising ``IndexError`` if dtype is ``timedelta64[ns]`` (:issue:`57956`)
1163+
- Bug in adding or subtracting a :class:`Timedelta` object with non-nanosecond unit to a python ``datetime.datetime`` object giving incorrect results; this now works correctly for Timedeltas inside the ``datetime.timedelta`` implementation bounds (:issue:`53643`)
11421164
- Bug in multiplication operations with ``timedelta64`` dtype failing to raise ``TypeError`` when multiplying by ``bool`` objects or dtypes (:issue:`58054`)
11431165
- Bug in multiplication operations with ``timedelta64`` dtype incorrectly raising when multiplying by numpy-nullable dtypes or pyarrow integer dtypes (:issue:`58054`)
11441166

environment.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ dependencies:
8686
- natsort # DataFrame.sort_values doctest
8787
- pickleshare # Needed for IPython Sphinx directive in the docs GH#60429
8888
- numpydoc
89-
- pydata-sphinx-theme=0.16
89+
# temporary installed with pip with custom patch until released
90+
# - pydata-sphinx-theme=0.16
9091
- pytest-cython # doctest
9192
- sphinx
9293
- sphinx-design
@@ -126,3 +127,4 @@ dependencies:
126127

127128
- pip:
128129
- tzdata>=2023.3
130+
- https://github.com/jorisvandenbossche/pydata-sphinx-theme/archive/refs/heads/v0.16.1+dismissable-announcement-banner.zip

pandas/_config/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ def using_string_dtype() -> bool:
3535
return _mode_options["infer_string"]
3636

3737

38+
def using_python_scalars() -> bool:
39+
_mode_options = _global_config["future"]
40+
return _mode_options["python_scalars"]
41+
42+
3843
def is_nan_na() -> bool:
3944
_mode_options = _global_config["future"]
4045
return not _mode_options["distinguish_nan_and_na"]

0 commit comments

Comments
 (0)