Skip to content

Commit c2a22cf

Browse files
update whatsnew
1 parent e3a9308 commit c2a22cf

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
@@ -636,6 +636,7 @@ Other
636636
- Bug in :meth:`DataFrame.apply` where passing ``engine="numba"`` ignored ``args`` passed to the applied function (:issue:`58712`)
637637
- 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`)
638638
- Bug in :meth:`DataFrame.eval` and :meth:`DataFrame.query` which did not allow to use ``tan`` function. (:issue:`55091`)
639+
- Bug in :meth:`DataFrame.query` which raised a ``KeyError`` when the expression contained column names with characters like ``#``. (:issue:`59285`)
639640
- 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`)
640641
- Bug in :meth:`DataFrame.transform` that was returning the wrong order unless the index was monotonically increasing. (:issue:`57069`)
641642
- 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
@@ -4613,7 +4613,7 @@ def query(self, expr: str, *, inplace: bool = False, **kwargs) -> DataFrame | No
46134613
column_name_to_escaped = {
46144614
col: urllib.parse.quote(col) for col in self.columns
46154615
}
4616-
# Odd-number indexes are column names
4616+
# A `token` with an odd-number index is a column name
46174617
escaped_expr = "`".join(
46184618
(column_name_to_escaped.get(token, token) if (i % 2) else token)
46194619
for i, token in enumerate(expr.split("`"))

0 commit comments

Comments
 (0)