From d0c1e0a23a4a43f38c2e23ce304c30c5ab498508 Mon Sep 17 00:00:00 2001 From: "JHM Darbyshire (MBP)" Date: Sat, 12 Jun 2021 19:40:52 +0200 Subject: [PATCH 1/2] 1.3.0 release notes and doc fix --- doc/source/whatsnew/v1.3.0.rst | 1 + pandas/io/formats/style.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/doc/source/whatsnew/v1.3.0.rst b/doc/source/whatsnew/v1.3.0.rst index dd95f9088e3da..1d4b1c89bc765 100644 --- a/doc/source/whatsnew/v1.3.0.rst +++ b/doc/source/whatsnew/v1.3.0.rst @@ -728,6 +728,7 @@ Deprecations - Using ``.astype`` to convert between ``datetime64[ns]`` dtype and :class:`DatetimeTZDtype` is deprecated and will raise in a future version, use ``obj.tz_localize`` or ``obj.dt.tz_localize`` instead (:issue:`38622`) - Deprecated casting ``datetime.date`` objects to ``datetime64`` when used as ``fill_value`` in :meth:`DataFrame.unstack`, :meth:`DataFrame.shift`, :meth:`Series.shift`, and :meth:`DataFrame.reindex`, pass ``pd.Timestamp(dateobj)`` instead (:issue:`39767`) - Deprecated :meth:`.Styler.set_na_rep` and :meth:`.Styler.set_precision` in favour of :meth:`.Styler.format` with ``na_rep`` and ``precision`` as existing and new input arguments respectively (:issue:`40134`, :issue:`40425`) +- Deprecated :meth:`.Styler.where` in favour of using an alternative formulation with :meth:`Styler.applymap` (:issue:`40821`) - Deprecated allowing partial failure in :meth:`Series.transform` and :meth:`DataFrame.transform` when ``func`` is list-like or dict-like and raises anything but ``TypeError``; ``func`` raising anything but a ``TypeError`` will raise in a future version (:issue:`40211`) - Deprecated arguments ``error_bad_lines`` and ``warn_bad_lines`` in :meth:`read_csv` and :meth:`read_table` in favor of argument ``on_bad_lines`` (:issue:`15122`) - Deprecated support for ``np.ma.mrecords.MaskedRecords`` in the :class:`DataFrame` constructor, pass ``{name: data[name] for name in data.dtype.names}`` instead (:issue:`40363`) diff --git a/pandas/io/formats/style.py b/pandas/io/formats/style.py index 93c3843b36846..c5aba539bd2dd 100644 --- a/pandas/io/formats/style.py +++ b/pandas/io/formats/style.py @@ -1206,12 +1206,14 @@ def where( recommend using instead. The example: + >>> df = pd.DataFrame([[1, 2], [3, 4]]) >>> def cond(v, limit=4): ... return v > 1 and v != limit >>> df.style.where(cond, value='color:green;', other='color:red;') should be refactored to: + >>> def style_func(v, value, other, limit=4): ... cond = v > 1 and v != limit ... return value if cond else other From 9da87d19dc9fa5add651ff2cd8f4087a01fc6e0f Mon Sep 17 00:00:00 2001 From: "JHM Darbyshire (iMac)" Date: Sun, 13 Jun 2021 09:16:09 +0200 Subject: [PATCH 2/2] remove depr method from toc --- doc/source/reference/style.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/source/reference/style.rst b/doc/source/reference/style.rst index 5a2ff803f0323..ae3647185f93d 100644 --- a/doc/source/reference/style.rst +++ b/doc/source/reference/style.rst @@ -34,7 +34,6 @@ Style application Styler.apply Styler.applymap - Styler.where Styler.format Styler.set_td_classes Styler.set_table_styles