Skip to content

Commit ce95aaa

Browse files
Merge branch 'main' into pandas.tseries.offsets.BMonthEnd
2 parents 5ede9d7 + 283a2dc commit ce95aaa

File tree

10 files changed

+26
-45
lines changed

10 files changed

+26
-45
lines changed

.github/workflows/wheels.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ jobs:
140140
run: echo "sdist_name=$(cd ./dist && ls -d */)" >> "$GITHUB_ENV"
141141

142142
- name: Build wheels
143-
uses: pypa/cibuildwheel@v2.17.0
143+
uses: pypa/cibuildwheel@v2.18.0
144144
with:
145145
package-dir: ./dist/${{ startsWith(matrix.buildplat[1], 'macosx') && env.sdist_name || needs.build_sdist.outputs.sdist_file }}
146146
env:

doc/source/development/policies.rst

+2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ deprecation removed in the next major release (2.0.0).
4646
These policies do not apply to features marked as **experimental** in the documentation.
4747
pandas may change the behavior of experimental features at any time.
4848

49+
.. _policies.python_support:
50+
4951
Python support
5052
~~~~~~~~~~~~~~
5153

doc/source/getting_started/install.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Instructions for installing :ref:`from source <install.source>`,
2121
Python version support
2222
----------------------
2323

24-
Officially Python 3.9, 3.10, 3.11 and 3.12.
24+
See :ref:`Python support policy <policies.python_support>`.
2525

2626
Installing pandas
2727
-----------------

doc/source/whatsnew/v0.13.0.rst

-1
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,6 @@ Float64Index API change
345345
.. ipython:: python
346346
:okwarning:
347347
348-
s[2:4]
349348
s.loc[2:4]
350349
s.iloc[2:4]
351350

doc/source/whatsnew/v3.0.0.rst

+1
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ Removal of prior version deprecations/changes
225225
- All arguments except ``name`` in :meth:`Index.rename` are now keyword only (:issue:`56493`)
226226
- All arguments except the first ``path``-like argument in IO writers are now keyword only (:issue:`54229`)
227227
- Changed behavior of :meth:`Series.__getitem__` and :meth:`Series.__setitem__` to always treat integer keys as labels, never as positional, consistent with :class:`DataFrame` behavior (:issue:`50617`)
228+
- Changed behavior of :meth:`Series.__getitem__`, :meth:`Series.__setitem__`, :meth:`DataFrame.__getitem__`, :meth:`DataFrame.__setitem__` with an integer slice on objects with a floating-dtype index. This is now treated as *positional* indexing (:issue:`49612`)
228229
- Disallow a callable argument to :meth:`Series.iloc` to return a ``tuple`` (:issue:`53769`)
229230
- Disallow allowing logical operations (``||``, ``&``, ``^``) between pandas objects and dtype-less sequences (e.g. ``list``, ``tuple``); wrap the objects in :class:`Series`, :class:`Index`, or ``np.array`` first instead (:issue:`52264`)
230231
- Disallow automatic casting to object in :class:`Series` logical operations (``&``, ``^``, ``||``) between series with mismatched indexes and dtypes other than ``object`` or ``bool`` (:issue:`52538`)

pandas/core/indexes/base.py

-19
Original file line numberDiff line numberDiff line change
@@ -4005,25 +4005,6 @@ def _convert_slice_indexer(self, key: slice, kind: Literal["loc", "getitem"]):
40054005

40064006
# TODO(GH#50617): once Series.__[gs]etitem__ is removed we should be able
40074007
# to simplify this.
4008-
if lib.is_np_dtype(self.dtype, "f"):
4009-
# We always treat __getitem__ slicing as label-based
4010-
# translate to locations
4011-
if kind == "getitem" and is_index_slice and not start == stop and step != 0:
4012-
# exclude step=0 from the warning because it will raise anyway
4013-
# start/stop both None e.g. [:] or [::-1] won't change.
4014-
# exclude start==stop since it will be empty either way, or
4015-
# will be [:] or [::-1] which won't change
4016-
warnings.warn(
4017-
# GH#49612
4018-
"The behavior of obj[i:j] with a float-dtype index is "
4019-
"deprecated. In a future version, this will be treated as "
4020-
"positional instead of label-based. For label-based slicing, "
4021-
"use obj.loc[i:j] instead",
4022-
FutureWarning,
4023-
stacklevel=find_stack_level(),
4024-
)
4025-
return self.slice_indexer(start, stop, step)
4026-
40274008
if kind == "getitem":
40284009
# called from the getitem slicers, validate that we are in fact integers
40294010
if is_index_slice:

pandas/tests/frame/indexing/test_indexing.py

+8-6
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,14 @@ def test_getitem_setitem_boolean_multi(self):
724724
expected.loc[[0, 2], [1]] = 5
725725
tm.assert_frame_equal(df, expected)
726726

727+
def test_getitem_float_label_positional(self):
728+
# GH 53338
729+
index = Index([1.5, 2])
730+
df = DataFrame(range(2), index=index)
731+
result = df[1:2]
732+
expected = DataFrame([1], index=[2.0])
733+
tm.assert_frame_equal(result, expected)
734+
727735
def test_getitem_setitem_float_labels(self):
728736
index = Index([1.5, 2, 3, 4, 5])
729737
df = DataFrame(np.random.default_rng(2).standard_normal((5, 5)), index=index)
@@ -748,12 +756,6 @@ def test_getitem_setitem_float_labels(self):
748756
expected = df.iloc[0:2]
749757
tm.assert_frame_equal(result, expected)
750758

751-
expected = df.iloc[0:2]
752-
msg = r"The behavior of obj\[i:j\] with a float-dtype index"
753-
with tm.assert_produces_warning(FutureWarning, match=msg):
754-
result = df[1:2]
755-
tm.assert_frame_equal(result, expected)
756-
757759
# #2727
758760
index = Index([1.0, 2.5, 3.5, 4.5, 5.0])
759761
df = DataFrame(np.random.default_rng(2).standard_normal((5, 5)), index=index)

pandas/tests/indexing/test_floats.py

+2-14
Original file line numberDiff line numberDiff line change
@@ -488,24 +488,12 @@ def test_floating_misc(self, indexer_sl):
488488
for fancy_idx in [[5, 0], np.array([5, 0])]:
489489
tm.assert_series_equal(indexer_sl(s)[fancy_idx], expected)
490490

491-
warn = FutureWarning if indexer_sl is tm.setitem else None
492-
msg = r"The behavior of obj\[i:j\] with a float-dtype index"
493-
494491
# all should return the same as we are slicing 'the same'
495-
with tm.assert_produces_warning(warn, match=msg):
496-
result1 = indexer_sl(s)[2:5]
497492
result2 = indexer_sl(s)[2.0:5.0]
498493
result3 = indexer_sl(s)[2.0:5]
499494
result4 = indexer_sl(s)[2.1:5]
500-
tm.assert_series_equal(result1, result2)
501-
tm.assert_series_equal(result1, result3)
502-
tm.assert_series_equal(result1, result4)
503-
504-
expected = Series([1, 2], index=[2.5, 5.0])
505-
with tm.assert_produces_warning(warn, match=msg):
506-
result = indexer_sl(s)[2:5]
507-
508-
tm.assert_series_equal(result, expected)
495+
tm.assert_series_equal(result2, result3)
496+
tm.assert_series_equal(result2, result4)
509497

510498
# list selection
511499
result1 = indexer_sl(s)[[0.0, 5, 10]]

pandas/tests/io/parser/test_multi_thread.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import pandas as pd
1414
from pandas import DataFrame
1515
import pandas._testing as tm
16+
from pandas.util.version import Version
1617

1718
xfail_pyarrow = pytest.mark.usefixtures("pyarrow_xfail")
1819

@@ -24,10 +25,16 @@
2425
]
2526

2627

27-
@xfail_pyarrow # ValueError: Found non-unique column index
28-
def test_multi_thread_string_io_read_csv(all_parsers):
28+
@pytest.mark.filterwarnings("ignore:Passing a BlockManager:DeprecationWarning")
29+
def test_multi_thread_string_io_read_csv(all_parsers, request):
2930
# see gh-11786
3031
parser = all_parsers
32+
if parser.engine == "pyarrow":
33+
pa = pytest.importorskip("pyarrow")
34+
if Version(pa.__version__) < Version("16.0"):
35+
request.applymarker(
36+
pytest.mark.xfail(reason="# ValueError: Found non-unique column index")
37+
)
3138
max_row_range = 100
3239
num_files = 10
3340

pandas/tests/io/test_sql.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -2302,7 +2302,8 @@ def test_api_read_sql_duplicate_columns(conn, request):
23022302
if "adbc" in conn:
23032303
pa = pytest.importorskip("pyarrow")
23042304
if not (
2305-
Version(pa.__version__) >= Version("16.0") and conn == "sqlite_adbc_conn"
2305+
Version(pa.__version__) >= Version("16.0")
2306+
and conn in ["sqlite_adbc_conn", "postgresql_adbc_conn"]
23062307
):
23072308
request.node.add_marker(
23082309
pytest.mark.xfail(

0 commit comments

Comments
 (0)