Fix for #56716: Use assert_produces_warning instead of pytest.raises to show FutureWarning
- [1] closes #56716
- [2] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [3] Replaced FutureWarning using pytest: pytest.raises(FutureWarning, match=msg): 
        with tm.assert_produces_warning

I solved my earlier PR on my main branch which is still open and updated all the code to this branch during commit. I will be careful hereon to create branches for new feature/bug. Any help so that the code in my main branch won't be reflected here.I am new and currently learning git. Closed by https://github.com/pandas-dev/pandas/pull/56974