Skip to content

Commit a46aac7

Browse files
update whatsnew
1 parent fc97251 commit a46aac7

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

doc/source/whatsnew/v3.0.0.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,7 @@ Other
643643
- Bug in :meth:`DataFrame.apply` where passing ``engine="numba"`` ignored ``args`` passed to the applied function (:issue:`58712`)
644644
- Bug in :meth:`DataFrame.eval` and :meth:`DataFrame.query` which caused an exception when using NumPy attributes via ``@`` notation, e.g., ``df.eval("@np.floor(a)")``. (:issue:`58041`)
645645
- Bug in :meth:`DataFrame.eval` and :meth:`DataFrame.query` which did not allow to use ``tan`` function. (:issue:`55091`)
646+
- Bug in :meth:`DataFrame.query` which raised a ``KeyError`` when the expression contained column names with characters like ``#``. (:issue:`59285`)
646647
- Bug in :meth:`DataFrame.sort_index` when passing ``axis="columns"`` and ``ignore_index=True`` and ``ascending=False`` not returning a :class:`RangeIndex` columns (:issue:`57293`)
647648
- Bug in :meth:`DataFrame.transform` that was returning the wrong order unless the index was monotonically increasing. (:issue:`57069`)
648649
- Bug in :meth:`DataFrame.where` where using a non-bool type array in the function would return a ``ValueError`` instead of a ``TypeError`` (:issue:`56330`)

pandas/core/frame.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4627,7 +4627,7 @@ def query(self, expr: str, *, inplace: bool = False, **kwargs) -> DataFrame | No
46274627
column_name_to_escaped = {
46284628
col: urllib.parse.quote(col) for col in self.columns
46294629
}
4630-
# Odd-number indexes are column names
4630+
# A `token` with an odd-number index is a column name
46314631
escaped_expr = "`".join(
46324632
(column_name_to_escaped.get(token, token) if (i % 2) else token)
46334633
for i, token in enumerate(expr.split("`"))

0 commit comments

Comments
 (0)