Reset the ``Styler``, removing any previously applied styles. Returns None. See Also -------- Styler.apply : Apply a CSS-styling function column-wise, row-wise, or table-wise. Styler.export : Export the styles applied to the current Styl
(self)
| 1885 | return self._copy(deepcopy=True) |
| 1886 | |
| 1887 | def clear(self) -> None: |
| 1888 | """ |
| 1889 | Reset the ``Styler``, removing any previously applied styles. |
| 1890 | |
| 1891 | Returns None. |
| 1892 | |
| 1893 | See Also |
| 1894 | -------- |
| 1895 | Styler.apply : Apply a CSS-styling function column-wise, row-wise, |
| 1896 | or table-wise. |
| 1897 | Styler.export : Export the styles applied to the current Styler. |
| 1898 | Styler.map : Apply a CSS-styling function elementwise. |
| 1899 | Styler.use : Set the styles on the current Styler. |
| 1900 | |
| 1901 | Examples |
| 1902 | -------- |
| 1903 | >>> df = pd.DataFrame({"A": [1, 2], "B": [3, np.nan]}) |
| 1904 | |
| 1905 | After any added style: |
| 1906 | |
| 1907 | >>> df.style.highlight_null(color="yellow") # doctest: +SKIP |
| 1908 | |
| 1909 | Remove it with: |
| 1910 | |
| 1911 | >>> df.style.clear() # doctest: +SKIP |
| 1912 | |
| 1913 | Please see: |
| 1914 | `Table Visualization <../../user_guide/style.ipynb>`_ for more examples. |
| 1915 | """ |
| 1916 | # create default GH 40675 |
| 1917 | clean_copy = Styler(self.data, uuid=self.uuid) |
| 1918 | clean_attrs = [a for a in clean_copy.__dict__ if not callable(a)] |
| 1919 | self_attrs = [a for a in self.__dict__ if not callable(a)] # maybe more attrs |
| 1920 | for attr in clean_attrs: |
| 1921 | setattr(self, attr, getattr(clean_copy, attr)) |
| 1922 | for attr in set(self_attrs).difference(clean_attrs): |
| 1923 | delattr(self, attr) |
| 1924 | |
| 1925 | def _apply( |
| 1926 | self, |