Skip to content

Commit 8f05f9f

Browse files
KhemkaranKhemkaran
authored andcommitted
Merge remote-tracking branch 'upstream/main' into issue_61917
2 parents deea1a0 + 962168f commit 8f05f9f

File tree

8 files changed

+34
-8
lines changed

8 files changed

+34
-8
lines changed

.github/workflows/unit-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ jobs:
9191
LANG: ${{ matrix.lang || 'C.UTF-8' }}
9292
LC_ALL: ${{ matrix.lc_all || '' }}
9393
PANDAS_CI: '1'
94-
PANDAS_FUTURE_INFER_STRING: ${{ matrix.pandas_future_infer_string || '0' }}
94+
PANDAS_FUTURE_INFER_STRING: ${{ matrix.pandas_future_infer_string || '1' }}
9595
TEST_ARGS: ${{ matrix.test_args || '' }}
9696
PYTEST_WORKERS: 'auto'
9797
PYTEST_TARGET: ${{ matrix.pytest_target || 'pandas' }}

doc/source/whatsnew/v3.0.0.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.. _whatsnew_300:
22

3-
What's new in 3.0.0 (Month XX, 2024)
3+
What's new in 3.0.0 (Month XX, 2025)
44
------------------------------------
55

66
These are the changes in pandas 3.0.0. See :ref:`release` for a full changelog
@@ -457,6 +457,7 @@ Other Deprecations
457457
- Deprecated :meth:`.DataFrameGroupby.corrwith` (:issue:`57158`)
458458
- Deprecated :meth:`Timestamp.utcfromtimestamp`, use ``Timestamp.fromtimestamp(ts, "UTC")`` instead (:issue:`56680`)
459459
- Deprecated :meth:`Timestamp.utcnow`, use ``Timestamp.now("UTC")`` instead (:issue:`56680`)
460+
- Deprecated ``pd.core.internals.api.maybe_infer_ndim`` (:issue:`40226`)
460461
- Deprecated allowing non-keyword arguments in :meth:`DataFrame.all`, :meth:`DataFrame.min`, :meth:`DataFrame.max`, :meth:`DataFrame.sum`, :meth:`DataFrame.prod`, :meth:`DataFrame.mean`, :meth:`DataFrame.median`, :meth:`DataFrame.sem`, :meth:`DataFrame.var`, :meth:`DataFrame.std`, :meth:`DataFrame.skew`, :meth:`DataFrame.kurt`, :meth:`Series.all`, :meth:`Series.min`, :meth:`Series.max`, :meth:`Series.sum`, :meth:`Series.prod`, :meth:`Series.mean`, :meth:`Series.median`, :meth:`Series.sem`, :meth:`Series.var`, :meth:`Series.std`, :meth:`Series.skew`, and :meth:`Series.kurt`. (:issue:`57087`)
461462
- Deprecated allowing non-keyword arguments in :meth:`Series.to_markdown` except ``buf``. (:issue:`57280`)
462463
- Deprecated allowing non-keyword arguments in :meth:`Series.to_string` except ``buf``. (:issue:`57280`)

pandas/_libs/internals.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -709,9 +709,9 @@ cdef class Block:
709709
self.ndim = state[2]
710710
else:
711711
# older pickle
712-
from pandas.core.internals.api import maybe_infer_ndim
712+
from pandas.core.internals.api import _maybe_infer_ndim
713713

714-
ndim = maybe_infer_ndim(self.values, self.mgr_locs)
714+
ndim = _maybe_infer_ndim(self.values, self.mgr_locs)
715715
self.ndim = ndim
716716

717717
cpdef Block slice_block_rows(self, slice slicer):

pandas/core/internals/api.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def make_block(
136136
if not isinstance(placement, BlockPlacement):
137137
placement = BlockPlacement(placement)
138138

139-
ndim = maybe_infer_ndim(values, placement, ndim)
139+
ndim = _maybe_infer_ndim(values, placement, ndim)
140140
if isinstance(values.dtype, (PeriodDtype, DatetimeTZDtype)):
141141
# GH#41168 ensure we can pass 1D dt64tz values
142142
# More generally, any EA dtype that isn't is_1d_only_ea_dtype
@@ -148,7 +148,7 @@ def make_block(
148148
return klass(values, ndim=ndim, placement=placement)
149149

150150

151-
def maybe_infer_ndim(values, placement: BlockPlacement, ndim: int | None) -> int:
151+
def _maybe_infer_ndim(values, placement: BlockPlacement, ndim: int | None) -> int:
152152
"""
153153
If `ndim` is not provided, infer it from placement and values.
154154
"""
@@ -162,3 +162,15 @@ def maybe_infer_ndim(values, placement: BlockPlacement, ndim: int | None) -> int
162162
else:
163163
ndim = values.ndim
164164
return ndim
165+
166+
167+
def maybe_infer_ndim(values, placement: BlockPlacement, ndim: int | None) -> int:
168+
"""
169+
If `ndim` is not provided, infer it from placement and values.
170+
"""
171+
warnings.warn(
172+
"maybe_infer_ndim is deprecated and will be removed in a future version.",
173+
DeprecationWarning,
174+
stacklevel=2,
175+
)
176+
return _maybe_infer_ndim(values, placement, ndim)

pandas/core/tools/numeric.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ def to_numeric(
5555
"""
5656
Convert argument to a numeric type.
5757
58-
The default return dtype is `float64` or `int64`
58+
If the input is already of a numeric dtype, the dtype will be preserved.
59+
For non-numeric inputs, the default return dtype is `float64` or `int64`
5960
depending on the data supplied. Use the `downcast` parameter
6061
to obtain other dtypes.
6162

pandas/tests/indexing/test_iloc.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import numpy as np
77
import pytest
88

9+
from pandas.compat import pa_version_under16p0
910
from pandas.errors import IndexingError
1011

1112
from pandas import (
@@ -140,6 +141,9 @@ def test_is_scalar_access(self):
140141
df = ser.to_frame()
141142
assert df.iloc._is_scalar_access((1, 0))
142143

144+
@pytest.mark.skipif(
145+
pa_version_under16p0, reason="https://github.com/apache/arrow/issues/40642"
146+
)
143147
def test_iloc_exceeds_bounds(self):
144148
# GH6296
145149
# iloc should allow indexers that exceed the bounds

pandas/tests/internals/test_api.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,15 @@ def test_create_block_manager_from_blocks_deprecated():
7979
internals.create_block_manager_from_blocks
8080

8181

82+
def test_maybe_infer_ndim_deprecated():
83+
# GH#40226
84+
msg = "maybe_infer_ndim is deprecated and will be removed in a future version."
85+
arr = np.arange(5)
86+
bp = pd._libs.internals.BlockPlacement([1])
87+
with tm.assert_produces_warning(DeprecationWarning, match=msg):
88+
internals.api.maybe_infer_ndim(arr, bp, 1)
89+
90+
8291
def test_create_dataframe_from_blocks(float_frame):
8392
block = float_frame._mgr.blocks[0]
8493
index = float_frame.index.copy()

pandas/tests/io/test_gcs.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,6 @@ def test_to_parquet_gcs_new_file(monkeypatch, tmpdir):
216216
{
217217
"int": [1, 3],
218218
"float": [2.0, np.nan],
219-
"str": ["t", "s"],
220219
"dt": date_range("2018-06-18", periods=2),
221220
}
222221
)

0 commit comments

Comments
 (0)