Skip to content

Commit c0318fa

Browse files
authored
Merge branch 'main' into dependabot/github_actions/pypa/cibuildwheel-2.21.0
2 parents 0ae1512 + efbc296 commit c0318fa

Some content is hidden

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

49 files changed

+369
-133
lines changed

.circleci/config.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,13 @@ jobs:
9292
no_output_timeout: 30m # Sometimes the tests won't generate any output, make sure the job doesn't get killed by that
9393
command: |
9494
pip3 install cibuildwheel==2.20.0
95-
cibuildwheel --output-dir wheelhouse
95+
if [[ $CIBW_BUILD == cp313t* ]]; then
96+
# TODO: temporarily run 3.13 free threaded builds without build isolation
97+
# since we need pre-release cython
98+
CIBW_BUILD_FRONTEND="pip; args: --no-build-isolation" cibuildwheel --output-dir wheelhouse
99+
else
100+
cibuildwheel --output-dir wheelhouse
101+
fi
96102
97103
environment:
98104
CIBW_BUILD: << parameters.cibw-build >>
@@ -141,6 +147,10 @@ workflows:
141147
cibw-build: ["cp310-manylinux_aarch64",
142148
"cp311-manylinux_aarch64",
143149
"cp312-manylinux_aarch64",
150+
"cp313-manylinux_aarch64",
151+
"cp313t-manylinux_aarch64",
144152
"cp310-musllinux_aarch64",
145153
"cp311-musllinux_aarch64",
146-
"cp312-musllinux_aarch64",]
154+
"cp312-musllinux_aarch64",
155+
"cp313-musllinux_aarch64",
156+
"cp313t-musllinux_aarch64"]

ci/code_checks.sh

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
7373
-i "pandas.Period.freq GL08" \
7474
-i "pandas.Period.ordinal GL08" \
7575
-i "pandas.RangeIndex.from_range PR01,SA01" \
76-
-i "pandas.RangeIndex.step SA01" \
7776
-i "pandas.Series.cat.add_categories PR01,PR02" \
7877
-i "pandas.Series.cat.as_ordered PR01" \
7978
-i "pandas.Series.cat.as_unordered PR01" \
@@ -97,14 +96,11 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
9796
-i "pandas.Series.dt.tz_localize PR01,PR02" \
9897
-i "pandas.Series.dt.unit GL08" \
9998
-i "pandas.Series.pad PR01,SA01" \
100-
-i "pandas.Series.sparse.fill_value SA01" \
10199
-i "pandas.Series.sparse.from_coo PR07,SA01" \
102100
-i "pandas.Series.sparse.npoints SA01" \
103-
-i "pandas.Series.sparse.sp_values SA01" \
104101
-i "pandas.Timedelta.max PR02" \
105102
-i "pandas.Timedelta.min PR02" \
106103
-i "pandas.Timedelta.resolution PR02" \
107-
-i "pandas.Timedelta.to_timedelta64 SA01" \
108104
-i "pandas.TimedeltaIndex.to_pytimedelta RT03,SA01" \
109105
-i "pandas.Timestamp.max PR02" \
110106
-i "pandas.Timestamp.min PR02" \
@@ -115,25 +111,18 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
115111
-i "pandas.api.types.is_dict_like PR07,SA01" \
116112
-i "pandas.api.types.is_file_like PR07,SA01" \
117113
-i "pandas.api.types.is_float PR01,SA01" \
118-
-i "pandas.api.types.is_float_dtype SA01" \
119114
-i "pandas.api.types.is_hashable PR01,RT03,SA01" \
120-
-i "pandas.api.types.is_int64_dtype SA01" \
121115
-i "pandas.api.types.is_integer PR01,SA01" \
122-
-i "pandas.api.types.is_interval_dtype SA01" \
123116
-i "pandas.api.types.is_iterator PR07,SA01" \
124-
-i "pandas.api.types.is_list_like SA01" \
125117
-i "pandas.api.types.is_named_tuple PR07,SA01" \
126-
-i "pandas.api.types.is_object_dtype SA01" \
127118
-i "pandas.api.types.is_re PR07,SA01" \
128119
-i "pandas.api.types.is_re_compilable PR07,SA01" \
129120
-i "pandas.api.types.pandas_dtype PR07,RT03,SA01" \
130121
-i "pandas.arrays.ArrowExtensionArray PR07,SA01" \
131-
-i "pandas.arrays.BooleanArray SA01" \
132122
-i "pandas.arrays.DatetimeArray SA01" \
133123
-i "pandas.arrays.IntegerArray SA01" \
134124
-i "pandas.arrays.IntervalArray.left SA01" \
135125
-i "pandas.arrays.IntervalArray.length SA01" \
136-
-i "pandas.arrays.IntervalArray.mid SA01" \
137126
-i "pandas.arrays.IntervalArray.right SA01" \
138127
-i "pandas.arrays.NumpyExtensionArray SA01" \
139128
-i "pandas.arrays.SparseArray PR07,SA01" \
@@ -144,7 +133,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
144133
-i "pandas.core.groupby.DataFrameGroupBy.boxplot PR07,RT03,SA01" \
145134
-i "pandas.core.groupby.DataFrameGroupBy.get_group RT03,SA01" \
146135
-i "pandas.core.groupby.DataFrameGroupBy.groups SA01" \
147-
-i "pandas.core.groupby.DataFrameGroupBy.hist RT03" \
148136
-i "pandas.core.groupby.DataFrameGroupBy.indices SA01" \
149137
-i "pandas.core.groupby.DataFrameGroupBy.nth PR02" \
150138
-i "pandas.core.groupby.DataFrameGroupBy.nunique SA01" \
@@ -164,7 +152,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
164152
-i "pandas.core.groupby.SeriesGroupBy.plot PR02" \
165153
-i "pandas.core.groupby.SeriesGroupBy.sem SA01" \
166154
-i "pandas.core.resample.Resampler.__iter__ RT03,SA01" \
167-
-i "pandas.core.resample.Resampler.ffill RT03" \
168155
-i "pandas.core.resample.Resampler.get_group RT03,SA01" \
169156
-i "pandas.core.resample.Resampler.groups SA01" \
170157
-i "pandas.core.resample.Resampler.indices SA01" \
@@ -179,7 +166,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
179166
-i "pandas.core.resample.Resampler.sum SA01" \
180167
-i "pandas.core.resample.Resampler.transform PR01,RT03,SA01" \
181168
-i "pandas.core.resample.Resampler.var SA01" \
182-
-i "pandas.date_range RT03" \
183169
-i "pandas.errors.AttributeConflictWarning SA01" \
184170
-i "pandas.errors.CSSWarning SA01" \
185171
-i "pandas.errors.CategoricalConversionWarning SA01" \
@@ -369,7 +355,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
369355
-i "pandas.tseries.offsets.SemiMonthBegin.n GL08" \
370356
-i "pandas.tseries.offsets.SemiMonthBegin.normalize GL08" \
371357
-i "pandas.tseries.offsets.SemiMonthBegin.rule_code GL08" \
372-
-i "pandas.tseries.offsets.SemiMonthEnd SA01" \
373358
-i "pandas.tseries.offsets.SemiMonthEnd.day_of_month GL08" \
374359
-i "pandas.tseries.offsets.SemiMonthEnd.is_on_offset GL08" \
375360
-i "pandas.tseries.offsets.SemiMonthEnd.n GL08" \

doc/source/whatsnew/v3.0.0.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,7 @@ I/O
619619
^^^
620620
- Bug in :class:`DataFrame` and :class:`Series` ``repr`` of :py:class:`collections.abc.Mapping`` elements. (:issue:`57915`)
621621
- Bug in :meth:`.DataFrame.to_json` when ``"index"`` was a value in the :attr:`DataFrame.column` and :attr:`Index.name` was ``None``. Now, this will fail with a ``ValueError`` (:issue:`58925`)
622+
- Bug in :meth:`DataFrame.from_records` where ``columns`` parameter with numpy structured array was not reordering and filtering out the columns (:issue:`59717`)
622623
- Bug in :meth:`DataFrame.to_dict` raises unnecessary ``UserWarning`` when columns are not unique and ``orient='tight'``. (:issue:`58281`)
623624
- Bug in :meth:`DataFrame.to_excel` when writing empty :class:`DataFrame` with :class:`MultiIndex` on both axes (:issue:`57696`)
624625
- Bug in :meth:`DataFrame.to_stata` when writing :class:`DataFrame` and ``byteorder=`big```. (:issue:`58969`)
@@ -630,6 +631,7 @@ I/O
630631
- Bug in :meth:`read_csv` where the order of the ``na_values`` makes an inconsistency when ``na_values`` is a list non-string values. (:issue:`59303`)
631632
- Bug in :meth:`read_excel` raising ``ValueError`` when passing array of boolean values when ``dtype="boolean"``. (:issue:`58159`)
632633
- Bug in :meth:`read_json` not validating the ``typ`` argument to not be exactly ``"frame"`` or ``"series"`` (:issue:`59124`)
634+
- Bug in :meth:`read_json` where extreme value integers in string format were incorrectly parsed as a different integer number (:issue:`20608`)
633635
- Bug in :meth:`read_stata` raising ``KeyError`` when input file is stored in big-endian format and contains strL data. (:issue:`58638`)
634636
- Bug in :meth:`read_stata` where extreme value integers were incorrectly interpreted as missing for format versions 111 and prior (:issue:`58130`)
635637
- Bug in :meth:`read_stata` where the missing code for double was not recognised for format versions 105 and prior (:issue:`58149`)

pandas/_libs/lib.pyx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,14 @@ cpdef ndarray[object] ensure_string_array(
754754

755755
if hasattr(arr, "to_numpy"):
756756

757-
if hasattr(arr, "dtype") and arr.dtype.kind in "mM":
757+
if (
758+
hasattr(arr, "dtype")
759+
and arr.dtype.kind in "mM"
760+
# TODO: we should add a custom ArrowExtensionArray.astype implementation
761+
# that handles astype(str) specifically, avoiding ending up here and
762+
# then we can remove the below check for `_pa_array` (for ArrowEA)
763+
and not hasattr(arr, "_pa_array")
764+
):
758765
# dtype check to exclude DataFrame
759766
# GH#41409 TODO: not a great place for this
760767
out = arr.astype(str).astype(object)
@@ -1213,6 +1220,12 @@ def is_list_like(obj: object, allow_sets: bool = True) -> bool:
12131220
bool
12141221
Whether `obj` has list-like properties.
12151222

1223+
See Also
1224+
--------
1225+
Series : One-dimensional ndarray with axis labels (including time series).
1226+
Index : Immutable sequence used for indexing and alignment.
1227+
numpy.ndarray : Array object from NumPy, which is considered list-like.
1228+
12161229
Examples
12171230
--------
12181231
>>> import datetime

pandas/_libs/tslibs/offsets.pyx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3316,6 +3316,11 @@ cdef class SemiMonthEnd(SemiMonthOffset):
33163316
"""
33173317
Two DateOffset's per month repeating on the last day of the month & day_of_month.
33183318
3319+
This offset allows for flexibility in generating date ranges or adjusting dates
3320+
to the end of a month or a specific day in the month, such as the 15th or the last
3321+
day of the month. It is useful for financial or scheduling applications where
3322+
events occur bi-monthly.
3323+
33193324
Attributes
33203325
----------
33213326
n : int, default 1
@@ -3325,6 +3330,13 @@ cdef class SemiMonthEnd(SemiMonthOffset):
33253330
day_of_month : int, {1, 3,...,27}, default 15
33263331
A specific integer for the day of the month.
33273332
3333+
See Also
3334+
--------
3335+
tseries.offsets.SemiMonthBegin : Offset for semi-monthly frequencies, starting at
3336+
the beginning of the month.
3337+
tseries.offsets.MonthEnd : Offset to the last calendar day of the month.
3338+
tseries.offsets.MonthBegin : Offset to the first calendar day of the month.
3339+
33283340
Examples
33293341
--------
33303342
>>> ts = pd.Timestamp(2022, 1, 14)

pandas/_libs/tslibs/timedeltas.pyx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1411,6 +1411,18 @@ cdef class _Timedelta(timedelta):
14111411
"""
14121412
Return a numpy.timedelta64 object with 'ns' precision.
14131413

1414+
Since NumPy uses ``timedelta64`` objects for its time operations, converting
1415+
a pandas ``Timedelta`` into a NumPy ``timedelta64`` provides seamless
1416+
integration between the two libraries, especially when working in environments
1417+
that heavily rely on NumPy for array-based calculations.
1418+
1419+
See Also
1420+
--------
1421+
to_timedelta : Convert argument to timedelta.
1422+
numpy.timedelta64 : A NumPy object for time duration.
1423+
Timedelta : Represents a duration, the difference between two dates
1424+
or times.
1425+
14141426
Examples
14151427
--------
14161428
>>> td = pd.Timedelta('3D')

pandas/_testing/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108

109109
COMPLEX_DTYPES: list[Dtype] = [complex, "complex64", "complex128"]
110110
if using_string_dtype():
111-
STRING_DTYPES: list[Dtype] = [str, "U"]
111+
STRING_DTYPES: list[Dtype] = ["U"]
112112
else:
113113
STRING_DTYPES: list[Dtype] = [str, "str", "U"] # type: ignore[no-redef]
114114
COMPLEX_FLOAT_DTYPES: list[Dtype] = [*COMPLEX_DTYPES, *FLOAT_NUMPY_DTYPES]

pandas/core/arrays/boolean.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,13 @@ class BooleanArray(BaseMaskedArray):
286286
-------
287287
BooleanArray
288288
289+
See Also
290+
--------
291+
array : Create an array from data with the appropriate dtype.
292+
BooleanDtype : Extension dtype for boolean data.
293+
Series : One-dimensional ndarray with axis labels (including time series).
294+
DataFrame : Two-dimensional, size-mutable, potentially heterogeneous tabular data.
295+
289296
Examples
290297
--------
291298
Create an BooleanArray with :func:`pandas.array`:

pandas/core/arrays/categorical.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2685,7 +2685,9 @@ def _str_get_dummies(self, sep: str = "|", dtype: NpDtype | None = None):
26852685
# sep may not be in categories. Just bail on this.
26862686
from pandas.core.arrays import NumpyExtensionArray
26872687

2688-
return NumpyExtensionArray(self.astype(str))._str_get_dummies(sep, dtype)
2688+
return NumpyExtensionArray(self.to_numpy(str, na_value="NaN"))._str_get_dummies(
2689+
sep, dtype
2690+
)
26892691

26902692
# ------------------------------------------------------------------------
26912693
# GroupBy Methods

pandas/core/arrays/datetimelike.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -471,10 +471,16 @@ def astype(self, dtype, copy: bool = True):
471471

472472
return self._box_values(self.asi8.ravel()).reshape(self.shape)
473473

474+
elif is_string_dtype(dtype):
475+
if isinstance(dtype, ExtensionDtype):
476+
arr_object = self._format_native_types(na_rep=dtype.na_value) # type: ignore[arg-type]
477+
cls = dtype.construct_array_type()
478+
return cls._from_sequence(arr_object, dtype=dtype, copy=False)
479+
else:
480+
return self._format_native_types()
481+
474482
elif isinstance(dtype, ExtensionDtype):
475483
return super().astype(dtype, copy=copy)
476-
elif is_string_dtype(dtype):
477-
return self._format_native_types()
478484
elif dtype.kind in "iu":
479485
# we deliberately ignore int32 vs. int64 here.
480486
# See https://github.com/pandas-dev/pandas/issues/24381 for more.

0 commit comments

Comments
 (0)