STYLE fix: pylint "consider-using-in" warning
- [x] Refers to one of the issues in https://github.com/pandas-dev/pandas/issues/48855

- [x] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html)

I have enabled  "consider-using-in" in pylint and fixed the parts in the code corresponding to it. Let me know if I should change anything. 
Thanks! Now all the pre-commit checks passed locally.