Skip to content

Commit 1e8e066

Browse files
committed
Merge branch 'rls-prep' of github.com:lithomas1/pandas into rls-prep
2 parents ef70754 + 2b042bb commit 1e8e066

File tree

16 files changed

+160
-49
lines changed

16 files changed

+160
-49
lines changed

.github/workflows/wheels.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,7 @@ jobs:
102102
python: [["cp310", "3.10"], ["cp311", "3.11"], ["cp312", "3.12"], ["cp313", "3.13"], ["cp313t", "3.13"]]
103103
include:
104104
# TODO: Remove this plus installing build deps in cibw_before_build.sh
105-
# and test deps in cibw_before_test.sh after pandas can be built with a released NumPy/Cython
106-
- python: ["cp313", "3.13"]
107-
cibw_build_frontend: 'pip; args: --no-build-isolation'
105+
# after pandas can be built with a released NumPy/Cython
108106
- python: ["cp313t", "3.13"]
109107
cibw_build_frontend: 'pip; args: --no-build-isolation'
110108
# Build Pyodide wheels and upload them to Anaconda.org
@@ -187,11 +185,9 @@ jobs:
187185
- name: Test Windows Wheels
188186
if: ${{ matrix.buildplat[1] == 'win_amd64' }}
189187
shell: pwsh
190-
# TODO: Remove NumPy nightly install when there's a 3.13 wheel on PyPI
191188
run: |
192189
$TST_CMD = @"
193190
python -m pip install hypothesis>=6.84.0 pytest>=7.3.2 pytest-xdist>=3.4.0;
194-
${{ matrix.python[1] == '3.13' && 'python -m pip install -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy;' }}
195191
python -m pip install `$(Get-Item pandas\wheelhouse\*.whl);
196192
python -c `'import pandas as pd; pd.test(extra_args=[`\"--no-strict-data-files`\", `\"-m not clipboard and not single_cpu and not slow and not network and not db`\"])`';
197193
"@

MANIFEST.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,3 @@ graft pandas/_libs/include
6565

6666
# Include cibw script in sdist since it's needed for building wheels
6767
include scripts/cibw_before_build.sh
68-
include scripts/cibw_before_test.sh

ci/code_checks.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
383383
-i "pandas.tseries.offsets.Week.n GL08" \
384384
-i "pandas.tseries.offsets.Week.normalize GL08" \
385385
-i "pandas.tseries.offsets.Week.weekday GL08" \
386-
-i "pandas.tseries.offsets.WeekOfMonth SA01" \
387386
-i "pandas.tseries.offsets.WeekOfMonth.is_on_offset GL08" \
388387
-i "pandas.tseries.offsets.WeekOfMonth.n GL08" \
389388
-i "pandas.tseries.offsets.WeekOfMonth.normalize GL08" \

pandas/_libs/tslibs/np_datetime.pxd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ cdef int string_to_dts(
8989
int* out_local,
9090
int* out_tzoffset,
9191
bint want_exc,
92-
format: str | None = *,
92+
str format = *,
9393
bint exact = *
9494
) except? -1
9595

pandas/_libs/tslibs/np_datetime.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ cdef int string_to_dts(
331331
int* out_local,
332332
int* out_tzoffset,
333333
bint want_exc,
334-
format: str | None=None,
334+
str format=None,
335335
bint exact=True,
336336
) except? -1:
337337
cdef:

pandas/_libs/tslibs/offsets.pyx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3582,6 +3582,11 @@ cdef class WeekOfMonth(WeekOfMonthMixin):
35823582
"""
35833583
Describes monthly dates like "the Tuesday of the 2nd week of each month".
35843584
3585+
This offset allows for generating or adjusting dates by specifying
3586+
a particular week and weekday within a month. The week is zero-indexed,
3587+
where 0 corresponds to the first week of the month, and weekday follows
3588+
a Monday=0 convention.
3589+
35853590
Attributes
35863591
----------
35873592
n : int, default 1
@@ -3602,6 +3607,12 @@ cdef class WeekOfMonth(WeekOfMonthMixin):
36023607
- 5 is Saturday
36033608
- 6 is Sunday.
36043609
3610+
See Also
3611+
--------
3612+
offsets.Week : Describes weekly frequency adjustments.
3613+
offsets.MonthEnd : Describes month-end frequency adjustments.
3614+
date_range : Generates a range of dates based on a specific frequency.
3615+
36053616
Examples
36063617
--------
36073618
>>> ts = pd.Timestamp(2022, 1, 1)

pandas/core/computation/eval.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@
1414
from pandas.util._exceptions import find_stack_level
1515
from pandas.util._validators import validate_bool_kwarg
1616

17-
from pandas.core.dtypes.common import is_extension_array_dtype
17+
from pandas.core.dtypes.common import (
18+
is_extension_array_dtype,
19+
is_string_dtype,
20+
)
1821

1922
from pandas.core.computation.engines import ENGINES
2023
from pandas.core.computation.expr import (
@@ -345,10 +348,13 @@ def eval(
345348
parsed_expr = Expr(expr, engine=engine, parser=parser, env=env)
346349

347350
if engine == "numexpr" and (
348-
is_extension_array_dtype(parsed_expr.terms.return_type)
351+
(
352+
is_extension_array_dtype(parsed_expr.terms.return_type)
353+
and not is_string_dtype(parsed_expr.terms.return_type)
354+
)
349355
or getattr(parsed_expr.terms, "operand_types", None) is not None
350356
and any(
351-
is_extension_array_dtype(elem)
357+
(is_extension_array_dtype(elem) and not is_string_dtype(elem))
352358
for elem in parsed_expr.terms.operand_types
353359
)
354360
):

pandas/core/computation/expr.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
from pandas.errors import UndefinedVariableError
2323

24+
from pandas.core.dtypes.common import is_string_dtype
25+
2426
import pandas.core.common as com
2527
from pandas.core.computation.ops import (
2628
ARITH_OPS_SYMS,
@@ -524,10 +526,12 @@ def _maybe_evaluate_binop(
524526
elif self.engine != "pytables":
525527
if (
526528
getattr(lhs, "return_type", None) == object
529+
or is_string_dtype(getattr(lhs, "return_type", None))
527530
or getattr(rhs, "return_type", None) == object
531+
or is_string_dtype(getattr(rhs, "return_type", None))
528532
):
529533
# evaluate "==" and "!=" in python if either of our operands
530-
# has an object return type
534+
# has an object or string return type
531535
return self._maybe_eval(res, eval_in_python + maybe_eval_in_python)
532536
return res
533537

pandas/tests/extension/test_sparse.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,11 +340,16 @@ def test_argmin_argmax_all_na(self, method, data, na_value):
340340
self._check_unsupported(data)
341341
super().test_argmin_argmax_all_na(method, data, na_value)
342342

343+
@pytest.mark.fails_arm_wheels
343344
@pytest.mark.parametrize("box", [pd.array, pd.Series, pd.DataFrame])
344345
def test_equals(self, data, na_value, as_series, box):
345346
self._check_unsupported(data)
346347
super().test_equals(data, na_value, as_series, box)
347348

349+
@pytest.mark.fails_arm_wheels
350+
def test_equals_same_data_different_object(self, data):
351+
super().test_equals_same_data_different_object(data)
352+
348353
@pytest.mark.parametrize(
349354
"func, na_action, expected",
350355
[

pandas/tests/frame/test_query_eval.py

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
import numpy as np
55
import pytest
66

7-
from pandas._config import using_string_dtype
8-
97
from pandas.errors import (
108
NumExprClobberingError,
119
UndefinedVariableError,
@@ -762,7 +760,6 @@ def test_inf(self, op, f, engine, parser):
762760
result = df.query(q, engine=engine, parser=parser)
763761
tm.assert_frame_equal(result, expected)
764762

765-
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
766763
def test_check_tz_aware_index_query(self, tz_aware_fixture):
767764
# https://github.com/pandas-dev/pandas/issues/29463
768765
tz = tz_aware_fixture
@@ -775,6 +772,7 @@ def test_check_tz_aware_index_query(self, tz_aware_fixture):
775772
tm.assert_frame_equal(result, expected)
776773

777774
expected = DataFrame(df_index)
775+
expected.columns = expected.columns.astype(object)
778776
result = df.reset_index().query('"2018-01-03 00:00:00+00" < time')
779777
tm.assert_frame_equal(result, expected)
780778

@@ -1072,7 +1070,7 @@ def test_query_with_string_columns(self, parser, engine):
10721070
with pytest.raises(NotImplementedError, match=msg):
10731071
df.query("a in b and c < d", parser=parser, engine=engine)
10741072

1075-
def test_object_array_eq_ne(self, parser, engine, using_infer_string):
1073+
def test_object_array_eq_ne(self, parser, engine):
10761074
df = DataFrame(
10771075
{
10781076
"a": list("aaaabbbbcccc"),
@@ -1081,14 +1079,11 @@ def test_object_array_eq_ne(self, parser, engine, using_infer_string):
10811079
"d": np.random.default_rng(2).integers(9, size=12),
10821080
}
10831081
)
1084-
warning = RuntimeWarning if using_infer_string and engine == "numexpr" else None
1085-
with tm.assert_produces_warning(warning):
1086-
res = df.query("a == b", parser=parser, engine=engine)
1082+
res = df.query("a == b", parser=parser, engine=engine)
10871083
exp = df[df.a == df.b]
10881084
tm.assert_frame_equal(res, exp)
10891085

1090-
with tm.assert_produces_warning(warning):
1091-
res = df.query("a != b", parser=parser, engine=engine)
1086+
res = df.query("a != b", parser=parser, engine=engine)
10921087
exp = df[df.a != df.b]
10931088
tm.assert_frame_equal(res, exp)
10941089

@@ -1128,15 +1123,13 @@ def test_query_with_nested_special_character(self, parser, engine):
11281123
],
11291124
)
11301125
def test_query_lex_compare_strings(
1131-
self, parser, engine, op, func, using_infer_string
1126+
self, parser, engine, op, func
11321127
):
11331128
a = Series(np.random.default_rng(2).choice(list("abcde"), 20))
11341129
b = Series(np.arange(a.size))
11351130
df = DataFrame({"X": a, "Y": b})
11361131

1137-
warning = RuntimeWarning if using_infer_string and engine == "numexpr" else None
1138-
with tm.assert_produces_warning(warning):
1139-
res = df.query(f'X {op} "d"', engine=engine, parser=parser)
1132+
res = df.query(f'X {op} "d"', engine=engine, parser=parser)
11401133
expected = df[func(df.X, "d")]
11411134
tm.assert_frame_equal(res, expected)
11421135

@@ -1400,15 +1393,13 @@ def test_expr_with_column_name_with_backtick(self):
14001393
expected = df[df["a`b"] < 2]
14011394
tm.assert_frame_equal(result, expected)
14021395

1403-
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
14041396
def test_expr_with_string_with_backticks(self):
14051397
# GH 59285
14061398
df = DataFrame(("`", "`````", "``````````"), columns=["#backticks"])
14071399
result = df.query("'```' < `#backticks`")
14081400
expected = df["```" < df["#backticks"]]
14091401
tm.assert_frame_equal(result, expected)
14101402

1411-
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
14121403
def test_expr_with_string_with_backticked_substring_same_as_column_name(self):
14131404
# GH 59285
14141405
df = DataFrame(("`", "`````", "``````````"), columns=["#backticks"])
@@ -1439,7 +1430,6 @@ def test_expr_with_column_names_with_special_characters(self, col1, col2, expr):
14391430
expected = df[df[col1] < df[col2]]
14401431
tm.assert_frame_equal(result, expected)
14411432

1442-
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
14431433
def test_expr_with_no_backticks(self):
14441434
# GH 59285
14451435
df = DataFrame(("aaa", "vvv", "zzz"), columns=["column_name"])
@@ -1483,15 +1473,13 @@ def test_expr_with_quote_opened_before_backtick_and_quote_is_unmatched(self):
14831473
):
14841474
df.query("`column-name` < 'It`s that\\'s \"quote\" #hash")
14851475

1486-
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
14871476
def test_expr_with_quote_opened_before_backtick_and_quote_is_matched_at_end(self):
14881477
# GH 59285
14891478
df = DataFrame(("aaa", "vvv", "zzz"), columns=["column-name"])
14901479
result = df.query("`column-name` < 'It`s that\\'s \"quote\" #hash'")
14911480
expected = df[df["column-name"] < 'It`s that\'s "quote" #hash']
14921481
tm.assert_frame_equal(result, expected)
14931482

1494-
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
14951483
def test_expr_with_quote_opened_before_backtick_and_quote_is_matched_in_mid(self):
14961484
# GH 59285
14971485
df = DataFrame(("aaa", "vvv", "zzz"), columns=["column-name"])

0 commit comments

Comments
 (0)