Skip to content

Commit 9721fc3

Browse files
Merge branch 'main' into fix-59242
2 parents 30ce3b3 + 5b16c06 commit 9721fc3

File tree

16 files changed

+42
-24
lines changed

16 files changed

+42
-24
lines changed

doc/source/user_guide/cookbook.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1043,7 +1043,7 @@ CSV
10431043

10441044
The :ref:`CSV <io.read_csv_table>` docs
10451045

1046-
`read_csv in action <https://wesmckinney.com/blog/update-on-upcoming-pandas-v0-10-new-file-parser-other-performance-wins/>`__
1046+
`read_csv in action <https://www.datacamp.com/tutorial/pandas-read-csv>`__
10471047

10481048
`appending to a csv
10491049
<https://stackoverflow.com/questions/17134942/pandas-dataframe-output-end-of-csv>`__

doc/source/user_guide/enhancingperf.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ prefer that Numba throw an error if it cannot compile a function in a way that
427427
speeds up your code, pass Numba the argument
428428
``nopython=True`` (e.g. ``@jit(nopython=True)``). For more on
429429
troubleshooting Numba modes, see the `Numba troubleshooting page
430-
<https://numba.pydata.org/numba-doc/latest/user/troubleshoot.html#the-compiled-code-is-too-slow>`__.
430+
<https://numba.readthedocs.io/en/stable/user/troubleshoot.html>`__.
431431

432432
Using ``parallel=True`` (e.g. ``@jit(parallel=True)``) may result in a ``SIGABRT`` if the threading layer leads to unsafe
433433
behavior. You can first `specify a safe threading layer <https://numba.readthedocs.io/en/stable/user/threading-layer.html#selecting-a-threading-layer-for-safe-parallel-execution>`__

doc/source/user_guide/pyarrow.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Data Structure Integration
2222

2323
A :class:`Series`, :class:`Index`, or the columns of a :class:`DataFrame` can be directly backed by a :external+pyarrow:py:class:`pyarrow.ChunkedArray`
2424
which is similar to a NumPy array. To construct these from the main pandas data structures, you can pass in a string of the type followed by
25-
``[pyarrow]``, e.g. ``"int64[pyarrow]""`` into the ``dtype`` parameter
25+
``[pyarrow]``, e.g. ``"int64[pyarrow]"`` into the ``dtype`` parameter
2626

2727
.. ipython:: python
2828

pandas/_config/config.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ def get_option(pat: str) -> Any:
141141
"""
142142
Retrieve the value of the specified option.
143143
144+
This method allows users to query the current value of a given option
145+
in the pandas configuration system. Options control various display,
146+
performance, and behavior-related settings within pandas.
147+
144148
Parameters
145149
----------
146150
pat : str

pandas/core/arraylike.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ def array_ufunc(self, ufunc: np.ufunc, method: str, *inputs: Any, **kwargs: Any)
329329
reconstruct_axes = dict(zip(self._AXIS_ORDERS, self.axes))
330330

331331
if self.ndim == 1:
332-
names = {getattr(x, "name") for x in inputs if hasattr(x, "name")}
332+
names = {x.name for x in inputs if hasattr(x, "name")}
333333
name = names.pop() if len(names) == 1 else None
334334
reconstruct_kwargs = {"name": name}
335335
else:

pandas/core/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ def is_full_slice(obj, line: int) -> bool:
359359
def get_callable_name(obj):
360360
# typical case has name
361361
if hasattr(obj, "__name__"):
362-
return getattr(obj, "__name__")
362+
return obj.__name__
363363
# some objects don't; could recurse
364364
if isinstance(obj, partial):
365365
return get_callable_name(obj.func)

pandas/core/dtypes/common.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1836,6 +1836,8 @@ def pandas_dtype(dtype) -> DtypeObj:
18361836
# raise a consistent TypeError if failed
18371837
try:
18381838
with warnings.catch_warnings():
1839+
# TODO: warnings.catch_warnings can be removed when numpy>2.2.2
1840+
# is the minimum version
18391841
# GH#51523 - Series.astype(np.integer) doesn't show
18401842
# numpy deprecation warning of np.integer
18411843
# Hence enabling DeprecationWarning

pandas/io/formats/style.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2021,7 +2021,7 @@ def apply(
20212021
more details.
20222022
"""
20232023
self._todo.append(
2024-
(lambda instance: getattr(instance, "_apply"), (func, axis, subset), kwargs)
2024+
(lambda instance: instance._apply, (func, axis, subset), kwargs)
20252025
)
20262026
return self
20272027

@@ -2128,7 +2128,7 @@ def apply_index(
21282128
"""
21292129
self._todo.append(
21302130
(
2131-
lambda instance: getattr(instance, "_apply_index"),
2131+
lambda instance: instance._apply_index,
21322132
(func, axis, level, "apply"),
21332133
kwargs,
21342134
)
@@ -2157,7 +2157,7 @@ def map_index(
21572157
) -> Styler:
21582158
self._todo.append(
21592159
(
2160-
lambda instance: getattr(instance, "_apply_index"),
2160+
lambda instance: instance._apply_index,
21612161
(func, axis, level, "map"),
21622162
kwargs,
21632163
)
@@ -2230,9 +2230,7 @@ def map(self, func: Callable, subset: Subset | None = None, **kwargs) -> Styler:
22302230
See `Table Visualization <../../user_guide/style.ipynb>`_ user guide for
22312231
more details.
22322232
"""
2233-
self._todo.append(
2234-
(lambda instance: getattr(instance, "_map"), (func, subset), kwargs)
2235-
)
2233+
self._todo.append((lambda instance: instance._map, (func, subset), kwargs))
22362234
return self
22372235

22382236
def set_table_attributes(self, attributes: str) -> Styler:

pandas/tests/dtypes/test_common.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import pandas._testing as tm
2323
from pandas.api.types import pandas_dtype
2424
from pandas.arrays import SparseArray
25+
from pandas.util.version import Version
2526

2627

2728
# EA & Actual Dtypes
@@ -788,11 +789,18 @@ def test_validate_allhashable():
788789

789790
def test_pandas_dtype_numpy_warning():
790791
# GH#51523
791-
with tm.assert_produces_warning(
792-
DeprecationWarning,
793-
check_stacklevel=False,
794-
match="Converting `np.integer` or `np.signedinteger` to a dtype is deprecated",
795-
):
792+
if Version(np.__version__) <= Version("2.2.2"):
793+
ctx = tm.assert_produces_warning(
794+
DeprecationWarning,
795+
check_stacklevel=False,
796+
match=(
797+
"Converting `np.integer` or `np.signedinteger` to a dtype is deprecated"
798+
),
799+
)
800+
else:
801+
ctx = tm.external_error_raised(TypeError)
802+
803+
with ctx:
796804
pandas_dtype(np.integer)
797805

798806

pandas/tests/generic/test_finalize.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ def test_timedelta_methods(method):
644644
operator.methodcaller("add_categories", ["c"]),
645645
operator.methodcaller("as_ordered"),
646646
operator.methodcaller("as_unordered"),
647-
lambda x: getattr(x, "codes"),
647+
lambda x: x.codes,
648648
operator.methodcaller("remove_categories", "a"),
649649
operator.methodcaller("remove_unused_categories"),
650650
operator.methodcaller("rename_categories", {"a": "A", "b": "B"}),

0 commit comments

Comments
 (0)