diff --git a/pandas/tests/io/formats/style/test_style.py b/pandas/tests/io/formats/style/test_style.py index 6fa72bd48031c..f94702fce4c85 100644 --- a/pandas/tests/io/formats/style/test_style.py +++ b/pandas/tests/io/formats/style/test_style.py @@ -1586,3 +1586,15 @@ def test_output_buffer(mi_styler, format): # gh 47053 with tm.ensure_clean(f"delete_me.{format}") as f: getattr(mi_styler, f"to_{format}")(f) + + +def test_deprecation_warning_for_usage_of_aaply_map_index_method_of_styler_object(): + # 56717 https://github.com/pandas-dev/pandas/issues/56717 + df = DataFrame([[1, 2], [3, 4]], index=["A", "B"]) + msg = "Styler.applymap_index has been deprecated. Use Styler.map_index instead." + + def color_b(s): + return "background-color:yellow;" + + with tm.assert_produces_warning(FutureWarning, match=msg): + df.style.applymap_index(color_b, axis="columns")