.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "checks_gallery/tabular/integrity/plot_is_single_value.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_checks_gallery_tabular_integrity_plot_is_single_value.py: Is Single Value *************** .. GENERATED FROM PYTHON SOURCE LINES 8-10 Imports ======= .. GENERATED FROM PYTHON SOURCE LINES 10-16 .. code-block:: default import pandas as pd from sklearn.datasets import load_iris from deepchecks.tabular.checks.integrity.is_single_value import IsSingleValue .. GENERATED FROM PYTHON SOURCE LINES 17-19 Load Data ========= .. GENERATED FROM PYTHON SOURCE LINES 19-25 .. code-block:: default iris = load_iris() X = iris.data df = pd.DataFrame({'a':[3,4,1], 'b':[2,2,2], 'c':[None, None, None], 'd':['a', 4, 6]}) df .. raw:: html
a b c d
0 3 2 None a
1 4 2 None 4
2 1 2 None 6


.. GENERATED FROM PYTHON SOURCE LINES 26-28 See functionality ================= .. GENERATED FROM PYTHON SOURCE LINES 28-31 .. code-block:: default IsSingleValue().run(pd.DataFrame(X)) .. raw:: html

Single Value in Column

Check if there are columns which have only a single unique value in all rows.

Additional Outputs

Nothing to display



.. GENERATED FROM PYTHON SOURCE LINES 32-35 .. code-block:: default IsSingleValue().run(pd.DataFrame({'a':[3,4], 'b':[2,2], 'c':[None, None], 'd':['a', 4]})) .. raw:: html

Single Value in Column

Check if there are columns which have only a single unique value in all rows.

Additional Outputs
The following columns have only one unique value
  b c
Single unique value 2 None


.. GENERATED FROM PYTHON SOURCE LINES 36-40 .. code-block:: default sv = IsSingleValue() sv.run(df) .. raw:: html

Single Value in Column

Check if there are columns which have only a single unique value in all rows.

Additional Outputs
The following columns have only one unique value
  b c
Single unique value 2 None


.. GENERATED FROM PYTHON SOURCE LINES 41-44 .. code-block:: default sv_ignore = IsSingleValue(ignore_columns=['b','c']) sv_ignore.run(df) .. raw:: html

Single Value in Column

Check if there are columns which have only a single unique value in all rows.

Additional Outputs

Nothing to display



.. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.050 seconds) .. _sphx_glr_download_checks_gallery_tabular_integrity_plot_is_single_value.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_is_single_value.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_is_single_value.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_