.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "checks_gallery/tabular/data_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_data_integrity_plot_is_single_value.py: .. _plot_tabular_is_single_value: Is Single Value *************** .. GENERATED FROM PYTHON SOURCE LINES 10-12 Imports ======= .. GENERATED FROM PYTHON SOURCE LINES 12-19 .. code-block:: default import numpy as np import pandas as pd from sklearn.datasets import load_iris from deepchecks.tabular.checks import IsSingleValue .. GENERATED FROM PYTHON SOURCE LINES 20-22 Load Data ========= .. GENERATED FROM PYTHON SOURCE LINES 22-28 .. 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 29-31 See functionality ================= .. GENERATED FROM PYTHON SOURCE LINES 31-34 .. code-block:: default IsSingleValue().run(pd.DataFrame(X)) .. raw:: html
Single Value in Column


.. GENERATED FROM PYTHON SOURCE LINES 35-38 .. 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


.. GENERATED FROM PYTHON SOURCE LINES 39-43 .. code-block:: default sv = IsSingleValue() sv.run(df) .. raw:: html
Single Value in Column


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


.. GENERATED FROM PYTHON SOURCE LINES 49-58 .. code-block:: default # Ignoring NaN values IsSingleValue(ignore_nan=True).run(pd.DataFrame({ 'a': [3, np.nan], 'b': [2, 2], 'c': [None, np.nan], 'd': ['a', 4] })) .. raw:: html
Single Value in Column


.. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.169 seconds) .. _sphx_glr_download_checks_gallery_tabular_data_integrity_plot_is_single_value.py: .. only:: html .. container:: sphx-glr-footer 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 `_