Skip to content

Commit 638cb77

Browse files
Merge remote-tracking branch 'upstream/main' into fix-string-frame-methods
2 parents 40db2ea + e7c803c commit 638cb77

Some content is hidden

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

61 files changed

+776
-930
lines changed

.github/workflows/unit-tests.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,10 +385,12 @@ jobs:
385385
nogil: true
386386

387387
- name: Build Environment
388+
# TODO: Once numpy 2.2.1 is out, don't install nightly version
389+
# Tests segfault with numpy 2.2.0: https://github.com/numpy/numpy/pull/27955
388390
run: |
389391
python --version
390-
python -m pip install --upgrade pip setuptools wheel numpy meson[ninja]==1.2.1 meson-python==0.13.1
391-
python -m pip install --pre --extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple cython
392+
python -m pip install --upgrade pip setuptools wheel meson[ninja]==1.2.1 meson-python==0.13.1
393+
python -m pip install --pre --extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple cython numpy
392394
python -m pip install versioneer[toml]
393395
python -m pip install python-dateutil pytz tzdata hypothesis>=6.84.0 pytest>=7.3.2 pytest-xdist>=3.4.0 pytest-cov
394396
python -m pip install -ve . --no-build-isolation --no-index --no-deps -Csetup-args="--werror"

ci/code_checks.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
8181
-i "pandas.Timestamp.resolution PR02" \
8282
-i "pandas.Timestamp.tzinfo GL08" \
8383
-i "pandas.arrays.ArrowExtensionArray PR07,SA01" \
84-
-i "pandas.arrays.IntervalArray.length SA01" \
8584
-i "pandas.arrays.NumpyExtensionArray SA01" \
8685
-i "pandas.arrays.TimedeltaArray PR07,SA01" \
8786
-i "pandas.core.groupby.DataFrameGroupBy.plot PR02" \
@@ -94,11 +93,8 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
9493
-i "pandas.core.resample.Resampler.std SA01" \
9594
-i "pandas.core.resample.Resampler.transform PR01,RT03,SA01" \
9695
-i "pandas.core.resample.Resampler.var SA01" \
97-
-i "pandas.errors.UndefinedVariableError PR01,SA01" \
9896
-i "pandas.errors.ValueLabelTypeMismatch SA01" \
99-
-i "pandas.io.json.build_table_schema PR07,RT03,SA01" \
10097
-i "pandas.plotting.andrews_curves RT03,SA01" \
101-
-i "pandas.plotting.scatter_matrix PR07,SA01" \
10298
-i "pandas.tseries.offsets.BDay PR02,SA01" \
10399
-i "pandas.tseries.offsets.BQuarterBegin.is_on_offset GL08" \
104100
-i "pandas.tseries.offsets.BQuarterBegin.n GL08" \

doc/source/development/maintaining.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ Post-Release
488488
for reference):
489489

490490
- The pandas-dev and pydata mailing lists
491-
- Twitter, Mastodon, Telegram and LinkedIn
491+
- X, Mastodon, Telegram and LinkedIn
492492

493493
7. Update this release instructions to fix anything incorrect and to update about any
494494
change since the last release.

doc/source/user_guide/cookbook.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ Unlike agg, apply's callable is passed a sub-DataFrame which gives you access to
459459
df
460460
461461
# List the size of the animals with the highest weight.
462-
df.groupby("animal").apply(lambda subf: subf["size"][subf["weight"].idxmax()], include_groups=False)
462+
df.groupby("animal").apply(lambda subf: subf["size"][subf["weight"].idxmax()])
463463
464464
`Using get_group
465465
<https://stackoverflow.com/questions/14734533/how-to-access-pandas-groupby-dataframe-by-key>`__
@@ -482,7 +482,7 @@ Unlike agg, apply's callable is passed a sub-DataFrame which gives you access to
482482
return pd.Series(["L", avg_weight, True], index=["size", "weight", "adult"])
483483
484484
485-
expected_df = gb.apply(GrowUp, include_groups=False)
485+
expected_df = gb.apply(GrowUp)
486486
expected_df
487487
488488
`Expanding apply

doc/source/user_guide/groupby.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,7 +1074,7 @@ missing values with the ``ffill()`` method.
10741074
).set_index("date")
10751075
df_re
10761076
1077-
df_re.groupby("group").resample("1D", include_groups=False).ffill()
1077+
df_re.groupby("group").resample("1D").ffill()
10781078
10791079
.. _groupby.filter:
10801080

@@ -1252,13 +1252,13 @@ the argument ``group_keys`` which defaults to ``True``. Compare
12521252

12531253
.. ipython:: python
12541254
1255-
df.groupby("A", group_keys=True).apply(lambda x: x, include_groups=False)
1255+
df.groupby("A", group_keys=True).apply(lambda x: x)
12561256
12571257
with
12581258

12591259
.. ipython:: python
12601260
1261-
df.groupby("A", group_keys=False).apply(lambda x: x, include_groups=False)
1261+
df.groupby("A", group_keys=False).apply(lambda x: x)
12621262
12631263
12641264
Numba accelerated routines
@@ -1742,7 +1742,7 @@ column index name will be used as the name of the inserted column:
17421742
result = {"b_sum": x["b"].sum(), "c_mean": x["c"].mean()}
17431743
return pd.Series(result, name="metrics")
17441744
1745-
result = df.groupby("a").apply(compute_metrics, include_groups=False)
1745+
result = df.groupby("a").apply(compute_metrics)
17461746
17471747
result
17481748

doc/source/user_guide/visualization.rst

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1210,11 +1210,6 @@ You may set the ``xlabel`` and ``ylabel`` arguments to give the plot custom labe
12101210
for x and y axis. By default, pandas will pick up index name as xlabel, while leaving
12111211
it empty for ylabel.
12121212

1213-
.. ipython:: python
1214-
:suppress:
1215-
1216-
plt.figure();
1217-
12181213
.. ipython:: python
12191214
12201215
df.plot();

doc/source/whatsnew/v3.0.0.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ Other enhancements
5656
- :meth:`DataFrame.plot.scatter` argument ``c`` now accepts a column of strings, where rows with the same string are colored identically (:issue:`16827` and :issue:`16485`)
5757
- :func:`read_parquet` accepts ``to_pandas_kwargs`` which are forwarded to :meth:`pyarrow.Table.to_pandas` which enables passing additional keywords to customize the conversion to pandas, such as ``maps_as_pydicts`` to read the Parquet map data type as python dictionaries (:issue:`56842`)
5858
- :meth:`DataFrameGroupBy.transform`, :meth:`SeriesGroupBy.transform`, :meth:`DataFrameGroupBy.agg`, :meth:`SeriesGroupBy.agg`, :meth:`RollingGroupby.apply`, :meth:`ExpandingGroupby.apply`, :meth:`Rolling.apply`, :meth:`Expanding.apply`, :meth:`DataFrame.apply` with ``engine="numba"`` now supports positional arguments passed as kwargs (:issue:`58995`)
59+
- :meth:`Rolling.agg`, :meth:`Expanding.agg` and :meth:`ExponentialMovingWindow.agg` now accept :class:`NamedAgg` aggregations through ``**kwargs`` (:issue:`28333`)
5960
- :meth:`Series.map` can now accept kwargs to pass on to func (:issue:`59814`)
6061
- :meth:`pandas.concat` will raise a ``ValueError`` when ``ignore_index=True`` and ``keys`` is not ``None`` (:issue:`59274`)
6162
- :meth:`str.get_dummies` now accepts a ``dtype`` parameter to specify the dtype of the resulting DataFrame (:issue:`47872`)
@@ -553,6 +554,7 @@ Other Removals
553554
- Removed the ``method`` keyword in ``ExtensionArray.fillna``, implement ``ExtensionArray._pad_or_backfill`` instead (:issue:`53621`)
554555
- Removed the attribute ``dtypes`` from :class:`.DataFrameGroupBy` (:issue:`51997`)
555556
- Enforced deprecation of ``argmin``, ``argmax``, ``idxmin``, and ``idxmax`` returning a result when ``skipna=False`` and an NA value is encountered or all values are NA values; these operations will now raise in such cases (:issue:`33941`, :issue:`51276`)
557+
- Removed specifying ``include_groups=True`` in :class:`.DataFrameGroupBy.apply` and :class:`.Resampler.apply` (:issue:`7155`)
556558

557559
.. ---------------------------------------------------------------------------
558560
.. _whatsnew_300.performance:
@@ -801,6 +803,7 @@ Other
801803
- Bug in ``Series.list`` methods not preserving the original :class:`Index`. (:issue:`58425`)
802804
- Bug in ``Series.list`` methods not preserving the original name. (:issue:`60522`)
803805
- Bug in printing a :class:`DataFrame` with a :class:`DataFrame` stored in :attr:`DataFrame.attrs` raised a ``ValueError`` (:issue:`60455`)
806+
- Bug in printing a :class:`Series` with a :class:`DataFrame` stored in :attr:`Series.attrs` raised a ``ValueError`` (:issue:`60568`)
804807

805808
.. ***DO NOT USE THIS SECTION***
806809

pandas/_libs/tslibs/nattype.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ class NaTType(_NaT):
704704
difference between the current timezone and UTC.
705705
706706
Returns
707-
--------
707+
-------
708708
timedelta
709709
The difference between UTC and the local time as a `timedelta` object.
710710

pandas/_libs/tslibs/timestamps.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2217,7 +2217,7 @@ class Timestamp(_Timestamp):
22172217
difference between the current timezone and UTC.
22182218

22192219
Returns
2220-
--------
2220+
-------
22212221
timedelta
22222222
The difference between UTC and the local time as a `timedelta` object.
22232223

pandas/core/arrays/interval.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,6 +1306,20 @@ def length(self) -> Index:
13061306
"""
13071307
Return an Index with entries denoting the length of each Interval.
13081308
1309+
The length of an interval is calculated as the difference between
1310+
its `right` and `left` bounds. This property is particularly useful
1311+
when working with intervals where the size of the interval is an important
1312+
attribute, such as in time-series analysis or spatial data analysis.
1313+
1314+
See Also
1315+
--------
1316+
arrays.IntervalArray.left : Return the left endpoints of each Interval in
1317+
the IntervalArray as an Index.
1318+
arrays.IntervalArray.right : Return the right endpoints of each Interval in
1319+
the IntervalArray as an Index.
1320+
arrays.IntervalArray.mid : Return the midpoint of each Interval in the
1321+
IntervalArray as an Index.
1322+
13091323
Examples
13101324
--------
13111325

0 commit comments

Comments
 (0)