Skip to content

Commit bc106df

Browse files
committed
Merge remote-tracking branch 'upstream/main' into sequence_to_td64ns
2 parents 84c01da + d11ed2f commit bc106df

35 files changed

+328
-110
lines changed

.github/actions/build_pandas/action.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,6 @@ runs:
2222
fi
2323
shell: bash -el {0}
2424

25-
- name: Uninstall nomkl
26-
run: |
27-
if conda list nomkl | grep nomkl 1>/dev/null; then
28-
conda remove nomkl -y
29-
fi
30-
shell: bash -el {0}
31-
3225
- name: Build Pandas
3326
run: |
3427
if [[ ${{ inputs.editable }} == "true" ]]; then

.github/actions/setup-conda/action.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ runs:
99
- name: Install ${{ inputs.environment-file }}
1010
uses: mamba-org/setup-micromamba@v1
1111
with:
12-
# Pinning to avoid 2.0 failures
13-
micromamba-version: '1.5.10-0'
1412
environment-file: ${{ inputs.environment-file }}
1513
environment-name: test
1614
condarc-file: ci/.condarc

ci/code_checks.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
8989
-i "pandas.api.types.pandas_dtype PR07,RT03,SA01" \
9090
-i "pandas.arrays.ArrowExtensionArray PR07,SA01" \
9191
-i "pandas.arrays.IntegerArray SA01" \
92-
-i "pandas.arrays.IntervalArray.left SA01" \
9392
-i "pandas.arrays.IntervalArray.length SA01" \
9493
-i "pandas.arrays.IntervalArray.right SA01" \
9594
-i "pandas.arrays.NumpyExtensionArray SA01" \

ci/deps/actions-310-minimum_versions.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ dependencies:
77
- python=3.10
88

99
# build dependencies
10-
- versioneer[toml]
10+
- versioneer
1111
- cython>=0.29.33
12-
- meson[ninja]=1.2.1
12+
- meson=1.2.1
1313
- meson-python=0.13.1
1414

1515
# test dependencies

ci/deps/actions-310.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ dependencies:
55
- python=3.10
66

77
# build dependencies
8-
- versioneer[toml]
8+
- versioneer
99
- cython>=0.29.33
10-
- meson[ninja]=1.2.1
10+
- meson=1.2.1
1111
- meson-python=0.13.1
1212

1313
# test dependencies

ci/deps/actions-311-downstream_compat.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ dependencies:
66
- python=3.11
77

88
# build dependencies
9-
- versioneer[toml]
9+
- versioneer
1010
- cython>=0.29.33
11-
- meson[ninja]=1.2.1
11+
- meson=1.2.1
1212
- meson-python=0.13.1
1313

1414
# test dependencies

ci/deps/actions-311-numpydev.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ dependencies:
55
- python=3.11
66

77
# build dependencies
8-
- versioneer[toml]
9-
- meson[ninja]=1.2.1
8+
- versioneer
9+
- meson=1.2.1
1010
- meson-python=0.13.1
1111
- cython>=0.29.33
1212

ci/deps/actions-311-pyarrownightly.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ dependencies:
55
- python=3.11
66

77
# build dependencies
8-
- versioneer[toml]
9-
- meson[ninja]=1.2.1
8+
- versioneer
9+
- meson=1.2.1
1010
- cython>=0.29.33
1111
- meson-python=0.13.1
1212

ci/deps/actions-311.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ dependencies:
55
- python=3.11
66

77
# build dependencies
8-
- versioneer[toml]
8+
- versioneer
99
- cython>=0.29.33
10-
- meson[ninja]=1.2.1
10+
- meson=1.2.1
1111
- meson-python=0.13.1
1212

1313
# test dependencies

ci/deps/actions-312.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ dependencies:
55
- python=3.12
66

77
# build dependencies
8-
- versioneer[toml]
8+
- versioneer
99
- cython>=0.29.33
10-
- meson[ninja]=1.2.1
10+
- meson=1.2.1
1111
- meson-python=0.13.1
1212

1313
# test dependencies

ci/deps/actions-pypy-39.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ dependencies:
88
- python=3.9[build=*_pypy]
99

1010
# build dependencies
11-
- versioneer[toml]
11+
- versioneer
1212
- cython>=0.29.33
13-
- meson[ninja]=1.2.1
13+
- meson=1.2.1
1414
- meson-python=0.13.1
1515

1616
# test dependencies

ci/deps/circle-311-arm64.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ dependencies:
55
- python=3.11
66

77
# build dependencies
8-
- versioneer[toml]
8+
- versioneer
99
- cython>=0.29.33
10-
- meson[ninja]=1.2.1
10+
- meson=1.2.1
1111
- meson-python=0.13.1
1212

1313
# test dependencies

doc/source/whatsnew/v2.3.0.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ notable_bug_fix1
5454
Deprecations
5555
~~~~~~~~~~~~
5656
- Deprecated allowing non-``bool`` values for ``na`` in :meth:`.str.contains`, :meth:`.str.startswith`, and :meth:`.str.endswith` for dtypes that do not already disallow these (:issue:`59615`)
57-
-
57+
- Deprecated the ``"pyarrow_numpy"`` storage option for :class:`StringDtype` (:issue:`60152`)
5858

5959
.. ---------------------------------------------------------------------------
6060
.. _whatsnew_230.performance:

doc/source/whatsnew/v3.0.0.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ Other enhancements
5454
- :meth:`Series.cummin` and :meth:`Series.cummax` now supports :class:`CategoricalDtype` (:issue:`52335`)
5555
- :meth:`Series.plot` now correctly handle the ``ylabel`` parameter for pie charts, allowing for explicit control over the y-axis label (:issue:`58239`)
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`)
57+
- :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`)
5758
- :meth:`Series.map` can now accept kwargs to pass on to func (:issue:`59814`)
5859
- :meth:`pandas.concat` will raise a ``ValueError`` when ``ignore_index=True`` and ``keys`` is not ``None`` (:issue:`59274`)
5960
- :meth:`str.get_dummies` now accepts a ``dtype`` parameter to specify the dtype of the resulting DataFrame (:issue:`47872`)
@@ -688,6 +689,7 @@ I/O
688689
- Bug in :meth:`DataFrame.to_dict` raises unnecessary ``UserWarning`` when columns are not unique and ``orient='tight'``. (:issue:`58281`)
689690
- Bug in :meth:`DataFrame.to_excel` when writing empty :class:`DataFrame` with :class:`MultiIndex` on both axes (:issue:`57696`)
690691
- Bug in :meth:`DataFrame.to_stata` when writing :class:`DataFrame` and ``byteorder=`big```. (:issue:`58969`)
692+
- Bug in :meth:`DataFrame.to_stata` when writing more than 32,000 value labels. (:issue:`60107`)
691693
- Bug in :meth:`DataFrame.to_string` that raised ``StopIteration`` with nested DataFrames. (:issue:`16098`)
692694
- Bug in :meth:`HDFStore.get` was failing to save data of dtype datetime64[s] correctly (:issue:`59004`)
693695
- Bug in :meth:`read_csv` causing segmentation fault when ``encoding_errors`` is not a string. (:issue:`59059`)
@@ -738,6 +740,7 @@ Reshaping
738740
- Bug in :meth:`DataFrame.join` when a :class:`DataFrame` with a :class:`MultiIndex` would raise an ``AssertionError`` when :attr:`MultiIndex.names` contained ``None``. (:issue:`58721`)
739741
- Bug in :meth:`DataFrame.merge` where merging on a column containing only ``NaN`` values resulted in an out-of-bounds array access (:issue:`59421`)
740742
- Bug in :meth:`DataFrame.unstack` producing incorrect results when ``sort=False`` (:issue:`54987`, :issue:`55516`)
743+
- Bug in :meth:`DataFrame.merge` when merging two :class:`DataFrame` on ``intc`` or ``uintc`` types on Windows (:issue:`60091`, :issue:`58713`)
741744
- Bug in :meth:`DataFrame.pivot_table` incorrectly subaggregating results when called without an ``index`` argument (:issue:`58722`)
742745
- Bug in :meth:`DataFrame.unstack` producing incorrect results when manipulating empty :class:`DataFrame` with an :class:`ExtentionDtype` (:issue:`59123`)
743746

environment.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ dependencies:
77
- pip
88

99
# build dependencies
10-
- versioneer[toml]
10+
- versioneer
1111
- cython~=3.0.5
12-
- meson[ninja]=1.2.1
12+
- meson=1.2.1
1313
- meson-python=0.13.1
1414

1515
# test dependencies

pandas/core/apply.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -994,14 +994,15 @@ def wrapper(*args, **kwargs):
994994
self.func, # type: ignore[arg-type]
995995
self.args,
996996
self.kwargs,
997+
num_required_args=1,
997998
)
998999
# error: Argument 1 to "__call__" of "_lru_cache_wrapper" has
9991000
# incompatible type "Callable[..., Any] | str | list[Callable
10001001
# [..., Any] | str] | dict[Hashable,Callable[..., Any] | str |
10011002
# list[Callable[..., Any] | str]]"; expected "Hashable"
10021003
nb_looper = generate_apply_looper(
10031004
self.func, # type: ignore[arg-type]
1004-
**get_jit_arguments(engine_kwargs, kwargs),
1005+
**get_jit_arguments(engine_kwargs),
10051006
)
10061007
result = nb_looper(self.values, self.axis, *args)
10071008
# If we made the result 2-D, squeeze it back to 1-D
@@ -1158,9 +1159,11 @@ def numba_func(values, col_names, df_index, *args):
11581159

11591160
def apply_with_numba(self) -> dict[int, Any]:
11601161
func = cast(Callable, self.func)
1161-
args, kwargs = prepare_function_arguments(func, self.args, self.kwargs)
1162+
args, kwargs = prepare_function_arguments(
1163+
func, self.args, self.kwargs, num_required_args=1
1164+
)
11621165
nb_func = self.generate_numba_apply_func(
1163-
func, **get_jit_arguments(self.engine_kwargs, kwargs)
1166+
func, **get_jit_arguments(self.engine_kwargs)
11641167
)
11651168
from pandas.core._numba.extensions import set_numba_data
11661169

@@ -1298,9 +1301,11 @@ def numba_func(values, col_names_index, index, *args):
12981301

12991302
def apply_with_numba(self) -> dict[int, Any]:
13001303
func = cast(Callable, self.func)
1301-
args, kwargs = prepare_function_arguments(func, self.args, self.kwargs)
1304+
args, kwargs = prepare_function_arguments(
1305+
func, self.args, self.kwargs, num_required_args=1
1306+
)
13021307
nb_func = self.generate_numba_apply_func(
1303-
func, **get_jit_arguments(self.engine_kwargs, kwargs)
1308+
func, **get_jit_arguments(self.engine_kwargs)
13041309
)
13051310

13061311
from pandas.core._numba.extensions import set_numba_data

pandas/core/arrays/interval.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,6 +1233,22 @@ def left(self) -> Index:
12331233
"""
12341234
Return the left endpoints of each Interval in the IntervalArray as an Index.
12351235
1236+
This property provides access to the left endpoints of the intervals
1237+
contained within the IntervalArray. This can be useful for analyses where
1238+
the starting point of each interval is of interest, such as in histogram
1239+
creation, data aggregation, or any scenario requiring the identification
1240+
of the beginning of defined ranges. This property returns a ``pandas.Index``
1241+
object containing the midpoint for each interval.
1242+
1243+
See Also
1244+
--------
1245+
arrays.IntervalArray.right : Return the right endpoints of each Interval in
1246+
the IntervalArray as an Index.
1247+
arrays.IntervalArray.mid : Return the midpoint of each Interval in the
1248+
IntervalArray as an Index.
1249+
arrays.IntervalArray.contains : Check elementwise if the Intervals contain
1250+
the value.
1251+
12361252
Examples
12371253
--------
12381254

pandas/core/arrays/string_.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
Literal,
88
cast,
99
)
10+
import warnings
1011

1112
import numpy as np
1213

@@ -27,6 +28,7 @@
2728
)
2829
from pandas.compat.numpy import function as nv
2930
from pandas.util._decorators import doc
31+
from pandas.util._exceptions import find_stack_level
3032

3133
from pandas.core.dtypes.base import (
3234
ExtensionDtype,
@@ -154,7 +156,16 @@ def __init__(
154156
storage = "python"
155157

156158
if storage == "pyarrow_numpy":
157-
# TODO raise a deprecation warning
159+
warnings.warn(
160+
"The 'pyarrow_numpy' storage option name is deprecated and will be "
161+
'removed in pandas 3.0. Use \'pd.StringDtype(storage="pyarrow", '
162+
"na_value-np.nan)' to construct the same dtype.\nOr enable the "
163+
"'pd.options.future.infer_string = True' option globally and use "
164+
'the "str" alias as a shorthand notation to specify a dtype '
165+
'(instead of "string[pyarrow_numpy]").',
166+
FutureWarning,
167+
stacklevel=find_stack_level(),
168+
)
158169
storage = "pyarrow"
159170
na_value = np.nan
160171

@@ -254,7 +265,7 @@ def construct_from_string(cls, string) -> Self:
254265
elif string == "string[pyarrow]":
255266
return cls(storage="pyarrow")
256267
elif string == "string[pyarrow_numpy]":
257-
# TODO deprecate
268+
# this is deprecated in the dtype __init__, remove this in pandas 3.0
258269
return cls(storage="pyarrow_numpy")
259270
else:
260271
raise TypeError(f"Cannot construct a '{cls.__name__}' from '{string}'")

pandas/core/base.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
from pandas.core.dtypes.generic import (
4545
ABCDataFrame,
4646
ABCIndex,
47+
ABCMultiIndex,
4748
ABCSeries,
4849
)
4950
from pandas.core.dtypes.missing import (
@@ -1287,13 +1288,18 @@ def factorize(
12871288
if uniques.dtype == np.float16:
12881289
uniques = uniques.astype(np.float32)
12891290

1290-
if isinstance(self, ABCIndex):
1291-
# preserve e.g. MultiIndex
1291+
if isinstance(self, ABCMultiIndex):
1292+
# preserve MultiIndex
12921293
uniques = self._constructor(uniques)
12931294
else:
12941295
from pandas import Index
12951296

1296-
uniques = Index(uniques)
1297+
try:
1298+
uniques = Index(uniques, dtype=self.dtype)
1299+
except NotImplementedError:
1300+
# not all dtypes are supported in Index that are allowed for Series
1301+
# e.g. float16 or bytes
1302+
uniques = Index(uniques)
12971303
return codes, uniques
12981304

12991305
_shared_docs["searchsorted"] = """

pandas/core/generic.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3324,9 +3324,9 @@ def to_latex(
33243324
r"""
33253325
Render object to a LaTeX tabular, longtable, or nested table.
33263326
3327-
Requires ``\usepackage{{booktabs}}``. The output can be copy/pasted
3327+
Requires ``\usepackage{booktabs}``. The output can be copy/pasted
33283328
into a main LaTeX document or read from an external file
3329-
with ``\input{{table.tex}}``.
3329+
with ``\input{table.tex}``.
33303330
33313331
.. versionchanged:: 2.0.0
33323332
Refactored to use the Styler implementation via jinja2 templating.
@@ -3344,13 +3344,13 @@ def to_latex(
33443344
Write row names (index).
33453345
na_rep : str, default 'NaN'
33463346
Missing data representation.
3347-
formatters : list of functions or dict of {{str: function}}, optional
3347+
formatters : list of functions or dict of {str: function}, optional
33483348
Formatter functions to apply to columns' elements by position or
33493349
name. The result of each function must be a unicode string.
33503350
List must be of length equal to the number of columns.
33513351
float_format : one-parameter function or str, optional, default None
33523352
Formatter for floating point numbers. For example
3353-
``float_format="%.2f"`` and ``float_format="{{:0.2f}}".format`` will
3353+
``float_format="%.2f"`` and ``float_format="{:0.2f}".format`` will
33543354
both result in 0.1234 being formatted as 0.12.
33553355
sparsify : bool, optional
33563356
Set to False for a DataFrame with a hierarchical index to print
@@ -3367,7 +3367,7 @@ def to_latex(
33673367
columns of numbers, which default to 'r'.
33683368
longtable : bool, optional
33693369
Use a longtable environment instead of tabular. Requires
3370-
adding a \usepackage{{longtable}} to your LaTeX preamble.
3370+
adding a \usepackage{longtable} to your LaTeX preamble.
33713371
By default, the value will be read from the pandas config
33723372
module, and set to `True` if the option ``styler.latex.environment`` is
33733373
`"longtable"`.
@@ -3405,7 +3405,7 @@ def to_latex(
34053405
default value to "r".
34063406
multirow : bool, default True
34073407
Use \multirow to enhance MultiIndex rows. Requires adding a
3408-
\usepackage{{multirow}} to your LaTeX preamble. Will print
3408+
\usepackage{multirow} to your LaTeX preamble. Will print
34093409
centered labels (instead of top-aligned) across the contained
34103410
rows, separating groups via clines. The default will be read
34113411
from the pandas config module, and is set as the option
@@ -3416,15 +3416,15 @@ def to_latex(
34163416
default value to `True`.
34173417
caption : str or tuple, optional
34183418
Tuple (full_caption, short_caption),
3419-
which results in ``\caption[short_caption]{{full_caption}}``;
3419+
which results in ``\caption[short_caption]{full_caption}``;
34203420
if a single string is passed, no short caption will be set.
34213421
label : str, optional
3422-
The LaTeX label to be placed inside ``\label{{}}`` in the output.
3423-
This is used with ``\ref{{}}`` in the main ``.tex`` file.
3422+
The LaTeX label to be placed inside ``\label{}`` in the output.
3423+
This is used with ``\ref{}`` in the main ``.tex`` file.
34243424
34253425
position : str, optional
34263426
The LaTeX positional argument for tables, to be placed after
3427-
``\begin{{}}`` in the output.
3427+
``\begin{}`` in the output.
34283428
34293429
Returns
34303430
-------

0 commit comments

Comments
 (0)