BUG: Fix query doesn't support equals or not equals with Python parse…
…r (#40436)

- [X] closes #40436 
- [X] tests added / passed
- [X] Ensure all linting tests pass, see [here](https://pandas.pydata.org/pandas-docs/dev/development/contributing.html#code-standards) for how to run them
- [X] whatsnew entry

Could some of the pandas maintainers let me know if the failed checks are normal ? They are unrelated to any changes I've made as far as I know. > Could some of the pandas maintainers let me know if the failed checks are normal ? They are unrelated to any changes I've made as far as I know.

If you look at the failures in a run like https://github.com/pandas-dev/pandas/pull/40563/checks?check_run_id=2163292906, looks like they might be related? They look related to me.  Do these tests pass for you locally? > > Could some of the pandas maintainers let me know if the failed checks are normal ? They are unrelated to any changes I've made as far as I know.
> 
> If you look at the failures in a run like https://github.com/pandas-dev/pandas/pull/40563/checks?check_run_id=2163292906, looks like they might be related?

I understand that my changes had a broader impact than I had anticipated. Some of these tests hard coded the == and != operators as NotImplemented, which I have undone and this is causing them to fail. 

Will have to really dig around to understand if these changes I made are ok but simply failing tests which should be amended or if I may be introducing some bug(s). Will take much more time than anticipated. Ok, I dug further into this and I both understand more and less about the issue. I now understand that both the `pandas` and `python` visitors inherit from the same `BaseExprVisitor` albeit with different parameters for `disallow` and different `preparser` function.

However, I do not understand why `In` and `NotIn` were specifically disallowed for the `python` engine even though its treatment would be identical under both `PythonExprVisitor` and `PandasExprVisitor`. This appears quite intentional as removing `In` and `NotIn` from the `PythonExprVisitor` disallow list makes a few tests fail as they specifically expect queries using these bin ops to raise `NotImplemented`.

Could someone please educate me as to why this is desirable ? This pull request is stale because it has been open for thirty days with no activity. Please update or respond to this comment if you're still interested in working on this. would take this if you can merge master and will look again Thanks for the PR, but it appears to have gone stale. If interested in continuing, please merge master and a maintainer can have a second look.