Skip to content

Commit 8965a1d

Browse files
merge main
2 parents 536b1ed + 7fe270c commit 8965a1d

File tree

77 files changed

+461
-523
lines changed

Some content is hidden

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

77 files changed

+461
-523
lines changed

ci/code_checks.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
8484
-i "pandas.Timestamp.resolution PR02" \
8585
-i "pandas.Timestamp.tzinfo GL08" \
8686
-i "pandas.api.types.is_re_compilable PR07,SA01" \
87-
-i "pandas.api.types.pandas_dtype PR07,RT03,SA01" \
8887
-i "pandas.arrays.ArrowExtensionArray PR07,SA01" \
8988
-i "pandas.arrays.IntegerArray SA01" \
9089
-i "pandas.arrays.IntervalArray.length SA01" \

doc/source/whatsnew/v2.3.0.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ Interval
118118

119119
Indexing
120120
^^^^^^^^
121-
-
121+
- Fixed bug in :meth:`Index.get_indexer` round-tripping through string dtype when ``infer_string`` is enabled (:issue:`55834`)
122122
-
123123

124124
Missing

doc/source/whatsnew/v3.0.0.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,7 @@ I/O
702702
- Bug in :meth:`read_stata` raising ``KeyError`` when input file is stored in big-endian format and contains strL data. (:issue:`58638`)
703703
- Bug in :meth:`read_stata` where extreme value integers were incorrectly interpreted as missing for format versions 111 and prior (:issue:`58130`)
704704
- Bug in :meth:`read_stata` where the missing code for double was not recognised for format versions 105 and prior (:issue:`58149`)
705+
- Bug in :meth:`set_option` where setting the pandas option ``display.html.use_mathjax`` to ``False`` has no effect (:issue:`59884`)
705706
- Bug in :meth:`to_excel` where :class:`MultiIndex` columns would be merged to a single row when ``merge_cells=False`` is passed (:issue:`60274`)
706707

707708
Period

pandas/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@
191191

192192

193193
# module level doc-string
194+
__version__ = "3.0.0"
194195
__doc__ = """
195196
pandas - a powerful data analysis and manipulation library for Python
196197
=====================================================================

pandas/core/array_algos/replace.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,4 +151,6 @@ def re_replacer(s):
151151
if mask is None:
152152
values[:] = f(values)
153153
else:
154+
if values.ndim != mask.ndim:
155+
mask = np.broadcast_to(mask, values.shape)
154156
values[mask] = f(values[mask])

pandas/core/arrays/arrow/array.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1644,7 +1644,11 @@ def _accumulate(
16441644
else:
16451645
data_to_accum = data_to_accum.cast(pa.int64())
16461646

1647-
result = pyarrow_meth(data_to_accum, skip_nulls=skipna, **kwargs)
1647+
try:
1648+
result = pyarrow_meth(data_to_accum, skip_nulls=skipna, **kwargs)
1649+
except pa.ArrowNotImplementedError as err:
1650+
msg = f"operation '{name}' not supported for dtype '{self.dtype}'"
1651+
raise TypeError(msg) from err
16481652

16491653
if convert_to_int:
16501654
result = result.cast(pa_dtype)

pandas/core/dtypes/cast.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,6 +1162,7 @@ def convert_dtypes(
11621162

11631163
def maybe_infer_to_datetimelike(
11641164
value: npt.NDArray[np.object_],
1165+
convert_to_nullable_dtype: bool = False,
11651166
) -> np.ndarray | DatetimeArray | TimedeltaArray | PeriodArray | IntervalArray:
11661167
"""
11671168
we might have a array (or single object) that is datetime like,
@@ -1199,6 +1200,7 @@ def maybe_infer_to_datetimelike(
11991200
# numpy would have done it for us.
12001201
convert_numeric=False,
12011202
convert_non_numeric=True,
1203+
convert_to_nullable_dtype=convert_to_nullable_dtype,
12021204
dtype_if_all_nat=np.dtype("M8[s]"),
12031205
)
12041206

pandas/core/dtypes/common.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1785,16 +1785,22 @@ def pandas_dtype(dtype) -> DtypeObj:
17851785
17861786
Parameters
17871787
----------
1788-
dtype : object to be converted
1788+
dtype : object
1789+
The object to be converted into a dtype.
17891790
17901791
Returns
17911792
-------
17921793
np.dtype or a pandas dtype
1794+
The converted dtype, which can be either a numpy dtype or a pandas dtype.
17931795
17941796
Raises
17951797
------
17961798
TypeError if not a dtype
17971799
1800+
See Also
1801+
--------
1802+
api.types.is_dtype : Return true if the condition is satisfied for the arr_or_dtype.
1803+
17981804
Examples
17991805
--------
18001806
>>> pd.api.types.pandas_dtype(int)

pandas/core/frame.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2115,8 +2115,8 @@ def from_records(
21152115
"""
21162116
Convert structured or record ndarray to DataFrame.
21172117
2118-
Creates a DataFrame object from a structured ndarray, sequence of
2119-
tuples or dicts, or DataFrame.
2118+
Creates a DataFrame object from a structured ndarray, or sequence of
2119+
tuples or dicts.
21202120
21212121
Parameters
21222122
----------

pandas/core/indexes/base.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6556,7 +6556,16 @@ def _maybe_cast_listlike_indexer(self, target) -> Index:
65566556
"""
65576557
Analogue to maybe_cast_indexer for get_indexer instead of get_loc.
65586558
"""
6559-
return ensure_index(target)
6559+
target_index = ensure_index(target)
6560+
if (
6561+
not hasattr(target, "dtype")
6562+
and self.dtype == object
6563+
and target_index.dtype == "string"
6564+
):
6565+
# If we started with a list-like, avoid inference to string dtype if self
6566+
# is object dtype (coercing to string dtype will alter the missing values)
6567+
target_index = Index(target, dtype=self.dtype)
6568+
return target_index
65606569

65616570
@final
65626571
def _validate_indexer(

0 commit comments

Comments
 (0)