Repository: modin-project/modin

Issue:
BUG: Warning: Reading in CSV - Deprecation Warning 'mangle_dupe_cols'
### Modin version checks

- [X] I have checked that this issue has not already been reported.

- [X] I have confirmed this bug exists on the latest released version of Modin.

- [X] I have confirmed this bug exists on the main branch of Modin. (In order to do this you can follow [this guide](https://modin.readthedocs.io/en/stable/getting_started/installation.html#installing-from-the-github-master-branch).)


### Reproducible Example

```python
import modin.pandas as pd
import pandas
pdf = pandas.DataFrame({"a": [0]})
pdf.to_csv("/tmp/for_deprecation_warning.csv")
print(pd.read_csv("/tmp/for_deprecation_warning.csv"))
```


### Issue Description

Modin should read csv in without problems 


### Expected Behavior

No Warnings

### Error Logs

<details>

```python-traceback

FutureWarning: the 'mangle_dupe_cols' keyword is deprecated and will be removed in a future version. Please take steps to stop the use of 'mangle_dupe_cols'

```

</details>


### Installed Versions

<details>

INSTALLED VERSIONS
------------------
commit           : 621bc10e16c21ca4270a4c2a25aa05f814f2686b
python           : 3.9.10.final.0
python-bits      : 64
OS               : Linux
OS-release       : 5.14.0-70.26.1.el9_0.x86_64
Version          : #1 SMP PREEMPT Fri Sep 2 16:07:40 EDT 2022
machine          : x86_64
processor        : x86_64
byteorder        : little
LC_ALL           : None
LANG             : en_US.UTF-8
LOCALE           : en_US.UTF-8

Modin dependencies
------------------
modin            : 0.16.0
ray              : 2.0.0
dask             : 2022.01.1
distributed      : 2022.01.1
hdk              : None

pandas dependencies
-------------------
pandas           : 1.5.0
numpy            : 1.23.2
pytz             : 2022.2.1
dateutil         : 2.8.2
setuptools       : 53.0.0
pip              : 21.2.3
Cython           : 0.29.32
pytest           : None
hypothesis       : None
sphinx           : None
blosc            : None
feather          : None
xlsxwriter       : None
lxml.etree       : 4.6.5
html5lib         : None
pymysql          : 1.0.2
psycopg2         : 2.9.3
jinja2           : 3.1.2
IPython          : 8.4.0
pandas_datareader: None
bs4              : 4.11.1
bottleneck       : None
brotli           : None
fastparquet      : None
fsspec           : 2022.7.1
gcsfs            : None
matplotlib       : 3.5.3
numba            : None
numexpr          : None
odfpy            : None
openpyxl         : None
pandas_gbq       : None
pyarrow          : 6.0.1
pyreadstat       : None
pyxlsb           : None
s3fs             : None
scipy            : 1.9.0
snappy           : None
sqlalchemy       : 1.4.40
tables           : None
tabulate         : 0.8.10
xarray           : None
xlrd             : None
xlwt             : None
zstandard        : None
tzdata           : None

</details>



Discussion:
@benaurelschill thank you for reporting this bug. I can verify it at version 621bc10e16c21ca4270a4c2a25aa05f814f2686b. I will have to look some more to see how we can get rid of the warning.

Resolving patch:
diff --git a/modin/_compat/core/latest/base_io.py b/modin/_compat/core/latest/base_io.py
--- a/modin/_compat/core/latest/base_io.py
+++ b/modin/_compat/core/latest/base_io.py
@@ -72,7 +72,6 @@ def read_csv(
         usecols=None,
         squeeze=False,
         prefix=lib.no_default,
-        mangle_dupe_cols=True,
         dtype=None,
         engine=None,
         converters=None,
@@ -126,7 +125,6 @@ def read_csv(
             usecols=usecols,
             squeeze=squeeze,
             prefix=prefix,
-            mangle_dupe_cols=mangle_dupe_cols,
             dtype=dtype,
             engine=engine,
             converters=converters,
diff --git a/modin/_compat/pandas_api/latest/io.py b/modin/_compat/pandas_api/latest/io.py
--- a/modin/_compat/pandas_api/latest/io.py
+++ b/modin/_compat/pandas_api/latest/io.py
@@ -149,6 +149,9 @@ def read_csv(
         val.name for val in inspect.signature(pandas.read_csv).parameters.values()
     }
     _, _, _, f_locals = inspect.getargvalues(inspect.currentframe())
+    # mangle_dupe_cols has no effect starting in pandas 1.5. Exclude it from
+    # kwargs so pandas doesn't spuriously warn people not to use it.
+    f_locals.pop("mangle_dupe_cols", None)
     kwargs = {k: v for k, v in f_locals.items() if k in _pd_read_csv_signature}
     return _read(**kwargs)
 
@@ -264,6 +267,9 @@ def read_table(
     _, _, _, f_locals = inspect.getargvalues(inspect.currentframe())
     if f_locals.get("sep", sep) is False or f_locals.get("sep", sep) is no_default:
         f_locals["sep"] = "\t"
+    # mangle_dupe_cols has no effect starting in pandas 1.5. Exclude it from
+    # kwargs so pandas doesn't spuriously warn people not to use it.
+    f_locals.pop("mangle_dupe_cols", None)
     kwargs = {k: v for k, v in f_locals.items() if k in _pd_read_table_signature}
     return _read(**kwargs)
 
@@ -380,6 +386,9 @@ def read_excel(
     storage_options: "StorageOptions" = None,
 ) -> "DataFrame | dict[IntStrT, DataFrame]":
     _, _, _, kwargs = inspect.getargvalues(inspect.currentframe())
+    # mangle_dupe_cols has no effect starting in pandas 1.5. Exclude it from
+    # kwargs so pandas doesn't spuriously warn people not to use it.
+    kwargs.pop("mangle_dupe_cols", None)
 
     Engine.subscribe(_update_engine)
     from modin.core.execution.dispatching.factories.dispatcher import FactoryDispatcher


Test patch:
diff --git a/modin/pandas/test/test_io.py b/modin/pandas/test/test_io.py
--- a/modin/pandas/test/test_io.py
+++ b/modin/pandas/test/test_io.py
@@ -11,6 +11,7 @@
 # ANY KIND, either express or implied. See the License for the specific language
 # governing permissions and limitations under the License.
 
+import contextlib
 import pytest
 import numpy as np
 from packaging import version
@@ -117,6 +118,12 @@
 }
 
 
+@contextlib.contextmanager
+def _nullcontext():
+    """Replacement for contextlib.nullcontext missing in older Python."""
+    yield
+
+
 def assert_files_eq(path1, path2):
     with open(path1, "rb") as file1, open(path2, "rb") as file2:
         file1_content = file1.read()
@@ -490,12 +497,29 @@ def test_read_csv_mangle_dupe_cols(self):
             pytest.xfail(
                 "processing of duplicated columns in HDK storage format is not supported yet - issue #3080"
             )
-        with ensure_clean() as unique_filename:
+        with ensure_clean() as unique_filename, (
+            pytest.warns(
+                FutureWarning, match="'mangle_dupe_cols' keyword is deprecated"
+            )
+            if PandasCompatVersion.CURRENT == PandasCompatVersion.LATEST
+            else _nullcontext()
+        ):
             str_non_unique_cols = "col,col,col,col\n5, 6, 7, 8\n9, 10, 11, 12\n"
             eval_io_from_str(
                 str_non_unique_cols, unique_filename, mangle_dupe_cols=True
             )
 
+    # Putting this filterwarnings in setup.cfg doesn't seem to catch the error.
+    @pytest.mark.filterwarnings(
+        "error:.*'mangle_dupe_cols' keyword is deprecated:FutureWarning"
+    )
+    def test_read_csv_does_not_warn_mangle_dupe_cols_kwarg(self):
+        with ensure_clean() as unique_filename:
+            eval_io_from_str(
+                "a,b,c\n1,2,3\n",
+                unique_filename,
+            )
+
     # NA and Missing Data Handling tests
     @pytest.mark.parametrize("na_values", ["custom_nan", "73"])
     @pytest.mark.parametrize("keep_default_na", [True, False])