Updated `ruff pre-commit` version and modified few lines according to it.
#### Ruff 0.0.285 has been released (https://github.com/astral-sh/ruff-pre-commit).
So, I have updated the ruff version in `.pre-commit-config.yaml` file, ran `ruff .` and corrected few files according to the errors it showed.

- [ ] closes #xxxx (Replace xxxx with the GitHub issue number)
- [ ] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [x] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [ ] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [ ] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.

@mroeschke sir, can you please review the PR, Thank you. Thanks @Sai-Suraj-27 