MCPcopy
hub / github.com/pandas-dev/pandas / clear

Method clear

pandas/io/formats/style.py:1887–1923  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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,

Callers 15

mpl_cleanupFunction · 0.80
_replot_axFunction · 0.80
create_subplotsFunction · 0.80
_reset_cacheMethod · 0.80
replace_listMethod · 0.80
_iterparse_nodesMethod · 0.80
drop_tableMethod · 0.80
delete_rowsMethod · 0.80
_infer_columnsMethod · 0.80
_computeMethod · 0.80
formatMethod · 0.80
format_indexMethod · 0.80

Calls 2

StylerClass · 0.85
differenceMethod · 0.45

Tested by 10

mpl_cleanupFunction · 0.64
setup_methodMethod · 0.64
setup_methodMethod · 0.64
test_registry_resetsMethod · 0.64
clipboardFunction · 0.64
fsspectestFunction · 0.64
cleared_fsFunction · 0.64
test_clearFunction · 0.64