DOC: Error msg using Python keyword in numexpr query #18221
- [X] closes #18221 
- [X] tests added / passed
- [X] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [X] whatsnew entry

note if you are up for it, #6508 and this issue could be dealt with by allowing a string on the lhs, e.g.
``df.query('"class" > 0')`` for spaces / non-keywords. cc @chris-b1  # [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/18248?src=pr&el=h1) Report
> Merging [#18248](https://codecov.io/gh/pandas-dev/pandas/pull/18248?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/9e3ad63cdb030c6b369d9d822469bb968e2d1804?src=pr&el=desc) will **decrease** coverage by `0.01%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/18248/graphs/tree.svg?token=eZ4WkYLtcO&height=150&width=650&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/18248?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #18248      +/-   ##
==========================================
- Coverage   91.43%   91.41%   -0.02%     
==========================================
  Files         164      164              
  Lines       50090    50096       +6     
==========================================
- Hits        45798    45796       -2     
- Misses       4292     4300       +8
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.22% <100%> (ø)` | :arrow_up: |
| #single | `40.38% <85.71%> (-0.06%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/18248?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/18248?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.8% <ø> (-0.1%)` | :arrow_down: |
| [pandas/core/computation/expr.py](https://codecov.io/gh/pandas-dev/pandas/pull/18248?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29tcHV0YXRpb24vZXhwci5weQ==) | `88.65% <100%> (+0.17%)` | :arrow_up: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/18248?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/core/indexes/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/18248?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZXMucHk=) | `95.48% <0%> (+0.09%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/18248?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/18248?src=pr&el=footer). Last update [9e3ad63...0f477de](https://codecov.io/gh/pandas-dev/pandas/pull/18248?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
 # [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/18248?src=pr&el=h1) Report
> Merging [#18248](https://codecov.io/gh/pandas-dev/pandas/pull/18248?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/9e3ad63cdb030c6b369d9d822469bb968e2d1804?src=pr&el=desc) will **decrease** coverage by `0.01%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/18248/graphs/tree.svg?token=eZ4WkYLtcO&src=pr&height=150&width=650)](https://codecov.io/gh/pandas-dev/pandas/pull/18248?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #18248      +/-   ##
==========================================
- Coverage   91.43%   91.41%   -0.02%     
==========================================
  Files         164      164              
  Lines       50090    50096       +6     
==========================================
- Hits        45798    45796       -2     
- Misses       4292     4300       +8
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.22% <100%> (ø)` | :arrow_up: |
| #single | `40.38% <85.71%> (-0.06%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/18248?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/18248?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.8% <ø> (-0.1%)` | :arrow_down: |
| [pandas/core/computation/expr.py](https://codecov.io/gh/pandas-dev/pandas/pull/18248?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29tcHV0YXRpb24vZXhwci5weQ==) | `88.65% <100%> (+0.17%)` | :arrow_up: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/18248?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/core/indexes/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/18248?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZXMucHk=) | `95.48% <0%> (+0.09%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/18248?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/18248?src=pr&el=footer). Last update [9e3ad63...0f477de](https://codecov.io/gh/pandas-dev/pandas/pull/18248?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
 thanks @WillAyd  Is this working? I get a `'>' not supported between instances of 'str' and 'int'` error. If you think it’s not working I’d suggest opening a new issue with the required information and someone will take a look