Skip to content

Commit 970e0f0

Browse files
committed
Merge remote-tracking branch 'upstream/main' into ci/tests
2 parents bac11d4 + c5ea524 commit 970e0f0

File tree

17 files changed

+23
-70
lines changed

17 files changed

+23
-70
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/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/computation/parsing.py

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -123,16 +123,6 @@ def clean_column_name(name: Hashable) -> Hashable:
123123
-------
124124
name : hashable
125125
Returns the name after tokenizing and cleaning.
126-
127-
Notes
128-
-----
129-
For some cases, a name cannot be converted to a valid Python identifier.
130-
In that case :func:`tokenize_string` raises a SyntaxError.
131-
In that case, we just return the name unmodified.
132-
133-
If this name was used in the query string (this makes the query call impossible)
134-
an error will be raised by :func:`tokenize_backtick_quoted_string` instead,
135-
which is not caught and propagates to the user level.
136126
"""
137127
try:
138128
# Escape backticks
@@ -145,40 +135,6 @@ def clean_column_name(name: Hashable) -> Hashable:
145135
return name
146136

147137

148-
def tokenize_backtick_quoted_string(
149-
token_generator: Iterator[tokenize.TokenInfo], source: str, string_start: int
150-
) -> tuple[int, str]:
151-
"""
152-
Creates a token from a backtick quoted string.
153-
154-
Moves the token_generator forwards till right after the next backtick.
155-
156-
Parameters
157-
----------
158-
token_generator : Iterator[tokenize.TokenInfo]
159-
The generator that yields the tokens of the source string (Tuple[int, str]).
160-
The generator is at the first token after the backtick (`)
161-
162-
source : str
163-
The Python source code string.
164-
165-
string_start : int
166-
This is the start of backtick quoted string inside the source string.
167-
168-
Returns
169-
-------
170-
tok: Tuple[int, str]
171-
The token that represents the backtick quoted string.
172-
The integer is equal to BACKTICK_QUOTED_STRING (100).
173-
"""
174-
for _, tokval, start, _, _ in token_generator:
175-
if tokval == "`":
176-
string_end = start[1]
177-
break
178-
179-
return BACKTICK_QUOTED_STRING, source[string_start:string_end]
180-
181-
182138
class ParseState(Enum):
183139
DEFAULT = 0
184140
IN_BACKTICK = 1

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/extension/decimal/array.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ def to_numpy(
125125
return result
126126

127127
def __array_ufunc__(self, ufunc: np.ufunc, method: str, *inputs, **kwargs):
128-
#
129128
if not all(
130129
isinstance(t, self._HANDLED_TYPES + (DecimalArray,)) for t in inputs
131130
):

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"}),

pandas/tests/groupby/test_apply.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1390,7 +1390,7 @@ def test_empty_df(method, op):
13901390
# GH 47985
13911391
empty_df = DataFrame({"a": [], "b": []})
13921392
gb = empty_df.groupby("a", group_keys=True)
1393-
group = getattr(gb, "b")
1393+
group = gb.b
13941394

13951395
result = getattr(group, method)(op)
13961396
expected = Series(

0 commit comments

Comments
 (0)