From d0ff5e88bc2479154f785c6c8c5d60d4fee622d0 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 27 Jun 2024 16:39:24 +0000 Subject: [PATCH] Deployed 221c5eb with MkDocs version: 1.6.0 --- .nojekyll | 0 404.html | 503 ++ API reference/DataFrameChecks/index.html | 6242 +++++++++++++++ API reference/SeriesChecks/index.html | 4926 ++++++++++++ API reference/display/index.html | 1942 +++++ API reference/options/index.html | 1572 ++++ API reference/run_checks/index.html | 1040 +++ API reference/timer/index.html | 1032 +++ API reference/utils/index.html | 939 +++ assets/_mkdocstrings.css | 119 + assets/images/favicon.png | Bin 0 -> 1870 bytes assets/javascripts/bundle.ad660dcc.min.js | 29 + assets/javascripts/bundle.ad660dcc.min.js.map | 7 + assets/javascripts/lunr/min/lunr.ar.min.js | 1 + assets/javascripts/lunr/min/lunr.da.min.js | 18 + assets/javascripts/lunr/min/lunr.de.min.js | 18 + assets/javascripts/lunr/min/lunr.du.min.js | 18 + assets/javascripts/lunr/min/lunr.el.min.js | 1 + assets/javascripts/lunr/min/lunr.es.min.js | 18 + assets/javascripts/lunr/min/lunr.fi.min.js | 18 + assets/javascripts/lunr/min/lunr.fr.min.js | 18 + assets/javascripts/lunr/min/lunr.he.min.js | 1 + assets/javascripts/lunr/min/lunr.hi.min.js | 1 + assets/javascripts/lunr/min/lunr.hu.min.js | 18 + assets/javascripts/lunr/min/lunr.hy.min.js | 1 + assets/javascripts/lunr/min/lunr.it.min.js | 18 + assets/javascripts/lunr/min/lunr.ja.min.js | 1 + assets/javascripts/lunr/min/lunr.jp.min.js | 1 + assets/javascripts/lunr/min/lunr.kn.min.js | 1 + assets/javascripts/lunr/min/lunr.ko.min.js | 1 + assets/javascripts/lunr/min/lunr.multi.min.js | 1 + assets/javascripts/lunr/min/lunr.nl.min.js | 18 + assets/javascripts/lunr/min/lunr.no.min.js | 18 + assets/javascripts/lunr/min/lunr.pt.min.js | 18 + assets/javascripts/lunr/min/lunr.ro.min.js | 18 + assets/javascripts/lunr/min/lunr.ru.min.js | 18 + assets/javascripts/lunr/min/lunr.sa.min.js | 1 + .../lunr/min/lunr.stemmer.support.min.js | 1 + assets/javascripts/lunr/min/lunr.sv.min.js | 18 + assets/javascripts/lunr/min/lunr.ta.min.js | 1 + assets/javascripts/lunr/min/lunr.te.min.js | 1 + assets/javascripts/lunr/min/lunr.th.min.js | 1 + assets/javascripts/lunr/min/lunr.tr.min.js | 18 + assets/javascripts/lunr/min/lunr.vi.min.js | 1 + assets/javascripts/lunr/min/lunr.zh.min.js | 1 + assets/javascripts/lunr/tinyseg.js | 206 + assets/javascripts/lunr/wordcut.js | 6708 +++++++++++++++++ .../workers/search.b8dbb3d2.min.js | 42 + .../workers/search.b8dbb3d2.min.js.map | 7 + assets/stylesheets/main.6543a935.min.css | 1 + assets/stylesheets/main.6543a935.min.css.map | 1 + assets/stylesheets/palette.06af60db.min.css | 1 + .../stylesheets/palette.06af60db.min.css.map | 1 + index.html | 684 ++ objects.inv | Bin 0 -> 1119 bytes search/search_index.json | 1 + sitemap.xml | 3 + sitemap.xml.gz | Bin 0 -> 127 bytes usage/index.html | 967 +++ 59 files changed, 27260 insertions(+) create mode 100644 .nojekyll create mode 100644 404.html create mode 100644 API reference/DataFrameChecks/index.html create mode 100644 API reference/SeriesChecks/index.html create mode 100644 API reference/display/index.html create mode 100644 API reference/options/index.html create mode 100644 API reference/run_checks/index.html create mode 100644 API reference/timer/index.html create mode 100644 API reference/utils/index.html create mode 100644 assets/_mkdocstrings.css create mode 100644 assets/images/favicon.png create mode 100644 assets/javascripts/bundle.ad660dcc.min.js create mode 100644 assets/javascripts/bundle.ad660dcc.min.js.map create mode 100644 assets/javascripts/lunr/min/lunr.ar.min.js create mode 100644 assets/javascripts/lunr/min/lunr.da.min.js create mode 100644 assets/javascripts/lunr/min/lunr.de.min.js create mode 100644 assets/javascripts/lunr/min/lunr.du.min.js create mode 100644 assets/javascripts/lunr/min/lunr.el.min.js create mode 100644 assets/javascripts/lunr/min/lunr.es.min.js create mode 100644 assets/javascripts/lunr/min/lunr.fi.min.js create mode 100644 assets/javascripts/lunr/min/lunr.fr.min.js create mode 100644 assets/javascripts/lunr/min/lunr.he.min.js create mode 100644 assets/javascripts/lunr/min/lunr.hi.min.js create mode 100644 assets/javascripts/lunr/min/lunr.hu.min.js create mode 100644 assets/javascripts/lunr/min/lunr.hy.min.js create mode 100644 assets/javascripts/lunr/min/lunr.it.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ja.min.js create mode 100644 assets/javascripts/lunr/min/lunr.jp.min.js create mode 100644 assets/javascripts/lunr/min/lunr.kn.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ko.min.js create mode 100644 assets/javascripts/lunr/min/lunr.multi.min.js create mode 100644 assets/javascripts/lunr/min/lunr.nl.min.js create mode 100644 assets/javascripts/lunr/min/lunr.no.min.js create mode 100644 assets/javascripts/lunr/min/lunr.pt.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ro.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ru.min.js create mode 100644 assets/javascripts/lunr/min/lunr.sa.min.js create mode 100644 assets/javascripts/lunr/min/lunr.stemmer.support.min.js create mode 100644 assets/javascripts/lunr/min/lunr.sv.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ta.min.js create mode 100644 assets/javascripts/lunr/min/lunr.te.min.js create mode 100644 assets/javascripts/lunr/min/lunr.th.min.js create mode 100644 assets/javascripts/lunr/min/lunr.tr.min.js create mode 100644 assets/javascripts/lunr/min/lunr.vi.min.js create mode 100644 assets/javascripts/lunr/min/lunr.zh.min.js create mode 100644 assets/javascripts/lunr/tinyseg.js create mode 100644 assets/javascripts/lunr/wordcut.js create mode 100644 assets/javascripts/workers/search.b8dbb3d2.min.js create mode 100644 assets/javascripts/workers/search.b8dbb3d2.min.js.map create mode 100644 assets/stylesheets/main.6543a935.min.css create mode 100644 assets/stylesheets/main.6543a935.min.css.map create mode 100644 assets/stylesheets/palette.06af60db.min.css create mode 100644 assets/stylesheets/palette.06af60db.min.css.map create mode 100644 index.html create mode 100644 objects.inv create mode 100644 search/search_index.json create mode 100644 sitemap.xml create mode 100644 sitemap.xml.gz create mode 100644 usage/index.html diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/404.html b/404.html new file mode 100644 index 0000000..1ff0e5b --- /dev/null +++ b/404.html @@ -0,0 +1,503 @@ + + + +
+ + + + + + + + + + + + + + +_obj = pandas_obj
+
+
+ instance-attribute
+
+
+__init__(pandas_obj)
+
+assert_data(condition, subset=None, pass_message=' ✔️ Assertion passed ', fail_message=' ㄨ Assertion failed ', raise_exception=True, exception_to_raise=DataError, message_shows_condition=True, verbose=False)
+
+Tests whether Dataframe meets condition. Optionally raises an exception. Does not modify the DataFrame itself.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
condition |
+
+ Callable
+ |
+
+
+
+ Assertion criteria in the form of a lambda function, such as |
+ + required + | +
subset |
+
+ Union[str, List, None]
+ |
+
+
+
+ Optional, which column or columns to check the condition against. Applied after fn. Subsetting can also be done within the |
+
+ None
+ |
+
pass_message |
+
+ str
+ |
+
+
+
+ Message to display if the condition passes. + |
+
+ ' ✔️ Assertion passed '
+ |
+
fail_message |
+
+ str
+ |
+
+
+
+ Message to display if the condition fails. + |
+
+ ' ㄨ Assertion failed '
+ |
+
raise_exception |
+
+ bool
+ |
+
+
+
+ Whether to raise an exception if the condition fails. + |
+
+ True
+ |
+
exception_to_raise |
+
+ Type[BaseException]
+ |
+
+
+
+ The exception to raise if the condition fails and raise_exception is True. + |
+
+ DataError
+ |
+
message_shows_condition |
+
+ bool
+ |
+
+
+
+ Whether the fail/pass message should also print the assertion criteria + |
+
+ True
+ |
+
verbose |
+
+ bool
+ |
+
+
+
+ Whether to display the pass message if the condition passes. + |
+
+ False
+ |
+
Returns:
+Type | +Description | +
---|---|
+ DataFrame
+ |
+
+
+
+ The original DataFrame, unchanged. + |
+
assert_datetime(subset=None, pass_message=' ✔️ Assert datetime passed ', fail_message=None, raise_exception=True, exception_to_raise=TypeError, verbose=False)
+
+Tests whether Dataframe or subset of columns is datetime or timestamp. Optionally raises an exception. Does not modify the DataFrame itself.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
subset |
+
+ Union[str, List, None]
+ |
+
+
+
+ Optional, which column or columns to check the condition against. ` + |
+
+ None
+ |
+
pass_message |
+
+ str
+ |
+
+
+
+ Message to display if the condition passes. + |
+
+ ' ✔️ Assert datetime passed '
+ |
+
fail_message |
+
+ Union[str, None]
+ |
+
+
+
+ Message to display if the condition fails. + |
+
+ None
+ |
+
raise_exception |
+
+ bool
+ |
+
+
+
+ Whether to raise an exception if the condition fails. + |
+
+ True
+ |
+
exception_to_raise |
+
+ Type[BaseException]
+ |
+
+
+
+ The exception to raise if the condition fails and raise_exception is True. + |
+
+ TypeError
+ |
+
verbose |
+
+ bool
+ |
+
+
+
+ Whether to display the pass message if the condition passes. + |
+
+ False
+ |
+
Returns:
+Type | +Description | +
---|---|
+ DataFrame
+ |
+
+
+
+ The original DataFrame, unchanged. + |
+
assert_float(subset=None, pass_message=' ✔️ Assert float passed ', fail_message=None, raise_exception=True, exception_to_raise=TypeError, verbose=False)
+
+Tests whether Dataframe or subset of columns is floats. Optionally raises an exception. Does not modify the DataFrame itself.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
subset |
+
+ Union[str, List, None]
+ |
+
+
+
+ Optional, which column or columns to check the condition against. ` + |
+
+ None
+ |
+
pass_message |
+
+ str
+ |
+
+
+
+ Message to display if the condition passes. + |
+
+ ' ✔️ Assert float passed '
+ |
+
fail_message |
+
+ Union[str, None]
+ |
+
+
+
+ Message to display if the condition fails. + |
+
+ None
+ |
+
raise_exception |
+
+ bool
+ |
+
+
+
+ Whether to raise an exception if the condition fails. + |
+
+ True
+ |
+
exception_to_raise |
+
+ Type[BaseException]
+ |
+
+
+
+ The exception to raise if the condition fails and raise_exception is True. + |
+
+ TypeError
+ |
+
verbose |
+
+ bool
+ |
+
+
+
+ Whether to display the pass message if the condition passes. + |
+
+ False
+ |
+
Returns:
+Type | +Description | +
---|---|
+ DataFrame
+ |
+
+
+
+ The original DataFrame, unchanged. + |
+
assert_greater_than(min, or_equal_to=True, subset=None, pass_message=' ✔️ Assert minimum passed ', fail_message=' ㄨ Assert minimum failed ', raise_exception=True, exception_to_raise=DataError, verbose=False)
+
+Tests whether Dataframe or subset of columns is > or >= a value. Optionally raises an exception. Does not modify the DataFrame itself.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
min |
+
+ Any
+ |
+
+
+
+ the minimum value to compare DataFrame to. Accepts any type that can be used in >, such as int, float, str, datetime + |
+ + required + | +
or_equal_to |
+
+ bool
+ |
+
+
+
+ whether to test for >= min (True) or > min (False) + |
+
+ True
+ |
+
subset |
+
+ Union[str, List, None]
+ |
+
+
+
+ Optional, which column or columns to check the condition against. ` + |
+
+ None
+ |
+
pass_message |
+
+ str
+ |
+
+
+
+ Message to display if the condition passes. + |
+
+ ' ✔️ Assert minimum passed '
+ |
+
fail_message |
+
+ str
+ |
+
+
+
+ Message to display if the condition fails. + |
+
+ ' ㄨ Assert minimum failed '
+ |
+
raise_exception |
+
+ bool
+ |
+
+
+
+ Whether to raise an exception if the condition fails. + |
+
+ True
+ |
+
exception_to_raise |
+
+ Type[BaseException]
+ |
+
+
+
+ The exception to raise if the condition fails and raise_exception is True. + |
+
+ DataError
+ |
+
verbose |
+
+ bool
+ |
+
+
+
+ Whether to display the pass message if the condition passes. + |
+
+ False
+ |
+
Returns:
+Type | +Description | +
---|---|
+ DataFrame
+ |
+
+
+
+ The original DataFrame, unchanged. + |
+
assert_int(subset=None, pass_message=' ✔️ Assert integeer passed ', fail_message=None, raise_exception=True, exception_to_raise=TypeError, verbose=False)
+
+Tests whether Dataframe or subset of columns is integers. Optionally raises an exception. Does not modify the DataFrame itself.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
subset |
+
+ Union[str, List, None]
+ |
+
+
+
+ Optional, which column or columns to check the condition against. ` + |
+
+ None
+ |
+
pass_message |
+
+ str
+ |
+
+
+
+ Message to display if the condition passes. + |
+
+ ' ✔️ Assert integeer passed '
+ |
+
fail_message |
+
+ Union[str, None]
+ |
+
+
+
+ Message to display if the condition fails. + |
+
+ None
+ |
+
raise_exception |
+
+ bool
+ |
+
+
+
+ Whether to raise an exception if the condition fails. + |
+
+ True
+ |
+
exception_to_raise |
+
+ Type[BaseException]
+ |
+
+
+
+ The exception to raise if the condition fails and raise_exception is True. + |
+
+ TypeError
+ |
+
verbose |
+
+ bool
+ |
+
+
+
+ Whether to display the pass message if the condition passes. + |
+
+ False
+ |
+
Returns:
+Type | +Description | +
---|---|
+ DataFrame
+ |
+
+
+
+ The original DataFrame, unchanged. + |
+
assert_less_than(max, or_equal_to=True, subset=None, pass_message=' ✔️ Assert maximum passed ', fail_message=' ㄨ Assert maximum failed ', raise_exception=True, exception_to_raise=DataError, verbose=False)
+
+Tests whether Dataframe or subset of columns is < or <= a value. Optionally raises an exception. Does not modify the DataFrame itself.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
max |
+
+ Any
+ |
+
+
+
+ the max value to compare DataFrame to. Accepts any type that can be used in <, such as int, float, str, datetime + |
+ + required + | +
or_equal_to |
+
+ bool
+ |
+
+
+
+ whether to test for <= min (True) or < max (False) + |
+
+ True
+ |
+
subset |
+
+ Union[str, List, None]
+ |
+
+
+
+ Optional, which column or columns to check the condition against. ` + |
+
+ None
+ |
+
pass_message |
+
+ str
+ |
+
+
+
+ Message to display if the condition passes. + |
+
+ ' ✔️ Assert maximum passed '
+ |
+
fail_message |
+
+ str
+ |
+
+
+
+ Message to display if the condition fails. + |
+
+ ' ㄨ Assert maximum failed '
+ |
+
raise_exception |
+
+ bool
+ |
+
+
+
+ Whether to raise an exception if the condition fails. + |
+
+ True
+ |
+
exception_to_raise |
+
+ Type[BaseException]
+ |
+
+
+
+ The exception to raise if the condition fails and raise_exception is True. + |
+
+ DataError
+ |
+
verbose |
+
+ bool
+ |
+
+
+
+ Whether to display the pass message if the condition passes. + |
+
+ False
+ |
+
Returns:
+Type | +Description | +
---|---|
+ DataFrame
+ |
+
+
+
+ The original DataFrame, unchanged. + |
+
assert_negative(subset=None, assert_not_null=True, pass_message=' ✔️ Assert negative passed ', fail_message=' ㄨ Assert negative failed ', raise_exception=True, exception_to_raise=DataError, verbose=False)
+
+Tests whether Dataframe or subset of columns has all negative values. Optionally raises an exception. Does not modify the DataFrame itself.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
subset |
+
+ Union[str, List, None]
+ |
+
+
+
+ Optional, which column or columns to check the condition against.` + |
+
+ None
+ |
+
assert_not_null |
+
+ bool
+ |
+
+
+
+ Whether to also enforce that data has no nulls. + |
+
+ True
+ |
+
pass_message |
+
+ str
+ |
+
+
+
+ Message to display if the condition passes. + |
+
+ ' ✔️ Assert negative passed '
+ |
+
fail_message |
+
+ str
+ |
+
+
+
+ Message to display if the condition fails. + |
+
+ ' ㄨ Assert negative failed '
+ |
+
raise_exception |
+
+ bool
+ |
+
+
+
+ Whether to raise an exception if the condition fails. + |
+
+ True
+ |
+
exception_to_raise |
+
+ Type[BaseException]
+ |
+
+
+
+ The exception to raise if the condition fails and raise_exception is True. + |
+
+ DataError
+ |
+
verbose |
+
+ bool
+ |
+
+
+
+ Whether to display the pass message if the condition passes. + |
+
+ False
+ |
+
Returns:
+Type | +Description | +
---|---|
+ DataFrame
+ |
+
+
+
+ The original DataFrame, unchanged. + |
+
assert_not_null(subset=None, pass_message=' ✔️ Assert no nulls passed ', fail_message=' ㄨ Assert no nulls failed ', raise_exception=True, exception_to_raise=DataError, verbose=False)
+
+Tests whether Dataframe or subset of columns has no nulls. Optionally raises an exception. Does not modify the DataFrame itself.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
subset |
+
+ Union[str, List, None]
+ |
+
+
+
+ Optional, which column or columns to check the condition against. ` + |
+
+ None
+ |
+
pass_message |
+
+ str
+ |
+
+
+
+ Message to display if the condition passes. + |
+
+ ' ✔️ Assert no nulls passed '
+ |
+
fail_message |
+
+ str
+ |
+
+
+
+ Message to display if the condition fails. + |
+
+ ' ㄨ Assert no nulls failed '
+ |
+
raise_exception |
+
+ bool
+ |
+
+
+
+ Whether to raise an exception if the condition fails. + |
+
+ True
+ |
+
exception_to_raise |
+
+ Type[BaseException]
+ |
+
+
+
+ The exception to raise if the condition fails and raise_exception is True. + |
+
+ DataError
+ |
+
verbose |
+
+ bool
+ |
+
+
+
+ Whether to display the pass message if the condition passes. + |
+
+ False
+ |
+
Returns:
+Type | +Description | +
---|---|
+ DataFrame
+ |
+
+
+
+ The original DataFrame, unchanged. + |
+
assert_null(subset=None, pass_message=' ✔️ Assert all nulls passed ', fail_message=' ㄨ Assert all nulls failed ', raise_exception=True, exception_to_raise=DataError, verbose=False)
+
+Tests whether Dataframe or subset of columns has all nulls. Optionally raises an exception. Does not modify the DataFrame itself.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
subset |
+
+ Union[str, List, None]
+ |
+
+
+
+ Optional, which column or columns to check the condition against. ` + |
+
+ None
+ |
+
pass_message |
+
+ str
+ |
+
+
+
+ Message to display if the condition passes. + |
+
+ ' ✔️ Assert all nulls passed '
+ |
+
fail_message |
+
+ str
+ |
+
+
+
+ Message to display if the condition fails. + |
+
+ ' ㄨ Assert all nulls failed '
+ |
+
raise_exception |
+
+ bool
+ |
+
+
+
+ Whether to raise an exception if the condition fails. + |
+
+ True
+ |
+
exception_to_raise |
+
+ Type[BaseException]
+ |
+
+
+
+ The exception to raise if the condition fails and raise_exception is True. + |
+
+ DataError
+ |
+
verbose |
+
+ bool
+ |
+
+
+
+ Whether to display the pass message if the condition passes. + |
+
+ False
+ |
+
Returns:
+Type | +Description | +
---|---|
+ DataFrame
+ |
+
+
+
+ The original DataFrame, unchanged. + |
+
assert_positive(subset=None, assert_not_null=True, pass_message=' ✔️ Assert positive passed ', fail_message=' ㄨ Assert positive failed ', raise_exception=True, exception_to_raise=DataError, verbose=False)
+
+Tests whether Dataframe or subset of columns has all positive values. Optionally raises an exception. Does not modify the DataFrame itself.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
subset |
+
+ Union[str, List, None]
+ |
+
+
+
+ Optional, which column or columns to check the condition against. ` + |
+
+ None
+ |
+
assert_not_null |
+
+ bool
+ |
+
+
+
+ Whether to also enforce that data has no nulls. + |
+
+ True
+ |
+
pass_message |
+
+ str
+ |
+
+
+
+ Message to display if the condition passes. + |
+
+ ' ✔️ Assert positive passed '
+ |
+
fail_message |
+
+ str
+ |
+
+
+
+ Message to display if the condition fails. + |
+
+ ' ㄨ Assert positive failed '
+ |
+
raise_exception |
+
+ bool
+ |
+
+
+
+ Whether to raise an exception if the condition fails. + |
+
+ True
+ |
+
exception_to_raise |
+
+ Type[BaseException]
+ |
+
+
+
+ The exception to raise if the condition fails and raise_exception is True. + |
+
+ DataError
+ |
+
verbose |
+
+ bool
+ |
+
+
+
+ Whether to display the pass message if the condition passes. + |
+
+ False
+ |
+
Returns:
+Type | +Description | +
---|---|
+ DataFrame
+ |
+
+
+
+ The original DataFrame, unchanged. + |
+
assert_str(subset=None, pass_message=' ✔️ Assert string passed ', fail_message=None, raise_exception=True, exception_to_raise=TypeError, verbose=False)
+
+Tests whether Dataframe or subset of columns is strings. Optionally raises an exception. Does not modify the DataFrame itself.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
subset |
+
+ Union[str, List, None]
+ |
+
+
+
+ Optional, which column or columns to check the condition against. ` + |
+
+ None
+ |
+
pass_message |
+
+ str
+ |
+
+
+
+ Message to display if the condition passes. + |
+
+ ' ✔️ Assert string passed '
+ |
+
fail_message |
+
+ Union[str, None]
+ |
+
+
+
+ Message to display if the condition fails. + |
+
+ None
+ |
+
raise_exception |
+
+ bool
+ |
+
+
+
+ Whether to raise an exception if the condition fails. + |
+
+ True
+ |
+
exception_to_raise |
+
+ Type[BaseException]
+ |
+
+
+
+ The exception to raise if the condition fails and raise_exception is True. + |
+
+ TypeError
+ |
+
verbose |
+
+ bool
+ |
+
+
+
+ Whether to display the pass message if the condition passes. + |
+
+ False
+ |
+
Returns:
+Type | +Description | +
---|---|
+ DataFrame
+ |
+
+
+
+ The original DataFrame, unchanged. + |
+
assert_timedelta(subset=None, pass_message=' ✔️ Assert timedelta passed ', fail_message=None, raise_exception=True, exception_to_raise=TypeError, verbose=False)
+
+Tests whether Dataframe or subset of columns is of type timedelta. Optionally raises an exception. Does not modify the DataFrame itself.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
subset |
+
+ Union[str, List, None]
+ |
+
+
+
+ Optional, which column or columns to check the condition against. ` + |
+
+ None
+ |
+
pass_message |
+
+ str
+ |
+
+
+
+ Message to display if the condition passes. + |
+
+ ' ✔️ Assert timedelta passed '
+ |
+
fail_message |
+
+ Union[str, None]
+ |
+
+
+
+ Message to display if the condition fails. + |
+
+ None
+ |
+
raise_exception |
+
+ bool
+ |
+
+
+
+ Whether to raise an exception if the condition fails. + |
+
+ True
+ |
+
exception_to_raise |
+
+ Type[BaseException]
+ |
+
+
+
+ The exception to raise if the condition fails and raise_exception is True. + |
+
+ TypeError
+ |
+
verbose |
+
+ bool
+ |
+
+
+
+ Whether to display the pass message if the condition passes. + |
+
+ False
+ |
+
Returns:
+Type | +Description | +
---|---|
+ DataFrame
+ |
+
+
+
+ The original DataFrame, unchanged. + |
+
assert_type(dtype, subset=None, pass_message=' ✔️ Assert type passed ', fail_message=None, raise_exception=True, exception_to_raise=TypeError, verbose=False)
+
+Tests whether Dataframe or subset of columns meets type assumption. Optionally raises an exception. Does not modify the DataFrame itself.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
dtype |
+
+ Type[Any]
+ |
+
+
+
+ The required variable type + |
+ + required + | +
subset |
+
+ Union[str, List, None]
+ |
+
+
+
+ Optional, which column or columns to check the condition against. ` + |
+
+ None
+ |
+
pass_message |
+
+ str
+ |
+
+
+
+ Message to display if the condition passes. + |
+
+ ' ✔️ Assert type passed '
+ |
+
fail_message |
+
+ Union[str, None]
+ |
+
+
+
+ Message to display if the condition fails. + |
+
+ None
+ |
+
raise_exception |
+
+ bool
+ |
+
+
+
+ Whether to raise an exception if the condition fails. + |
+
+ True
+ |
+
exception_to_raise |
+
+ Type[BaseException]
+ |
+
+
+
+ The exception to raise if the condition fails and raise_exception is True. + |
+
+ TypeError
+ |
+
verbose |
+
+ bool
+ |
+
+
+
+ Whether to display the pass message if the condition passes. + |
+
+ False
+ |
+
Returns:
+Type | +Description | +
---|---|
+ DataFrame
+ |
+
+
+
+ The original DataFrame, unchanged. + |
+
assert_unique(subset=None, pass_message=' ✔️ Assert unique passed ', fail_message=' ㄨ Assert unique failed ', raise_exception=True, exception_to_raise=DataError, verbose=False)
+
+Tests whether Dataframe or subset of columns has no duplicate rows. Optionally raises an exception. Does not modify the DataFrame itself.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
subset |
+
+ Union[str, List, None]
+ |
+
+
+
+ Optional, which column or columns to check the condition against. ` + |
+
+ None
+ |
+
pass_message |
+
+ str
+ |
+
+
+
+ Message to display if the condition passes. + |
+
+ ' ✔️ Assert unique passed '
+ |
+
fail_message |
+
+ str
+ |
+
+
+
+ Message to display if the condition fails. + |
+
+ ' ㄨ Assert unique failed '
+ |
+
raise_exception |
+
+ bool
+ |
+
+
+
+ Whether to raise an exception if the condition fails. + |
+
+ True
+ |
+
exception_to_raise |
+
+ Type[BaseException]
+ |
+
+
+
+ The exception to raise if the condition fails and raise_exception is True. + |
+
+ DataError
+ |
+
verbose |
+
+ bool
+ |
+
+
+
+ Whether to display the pass message if the condition passes. + |
+
+ False
+ |
+
Returns:
+Type | +Description | +
---|---|
+ DataFrame
+ |
+
+
+
+ The original DataFrame, unchanged. + |
+
columns(fn=lambda df: df, subset=None, check_name='🏛️ Columns')
+
+Prints the column names of a DataFrame, without modifying the DataFrame itself.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
fn |
+
+ Callable
+ |
+
+
+
+ An optional lambda function to apply to the DataFrame before printing columns. Example: |
+
+ lambda df: df
+ |
+
subset |
+
+ Union[str, List, None]
+ |
+
+
+
+ An optional list of column names or a string to select a subset of columns before printing their names. Applied after fn. + |
+
+ None
+ |
+
check_name |
+
+ Union[str, None]
+ |
+
+
+
+ An optional name for the check to preface the result with. + |
+
+ '🏛️ Columns'
+ |
+
Returns:
+Type | +Description | +
---|---|
+ DataFrame
+ |
+
+
+
+ The original DataFrame, unchanged. + |
+
describe(fn=lambda df: df, subset=None, check_name='📏 Distributions', **kwargs)
+
+Displays descriptive statistics about a DataFrame without modifying the DataFrame itself.
+See Pandas docs for describe() for additional usage information, including more configuration options you can pass to this Pandas Checks method.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
fn |
+
+ Callable
+ |
+
+
+
+ An optional lambda function to apply to the DataFrame before running Pandas describe(). Example: |
+
+ lambda df: df
+ |
+
subset |
+
+ Union[str, List, None]
+ |
+
+
+
+ An optional list of column names or a string to select a subset of columns before running Pandas describe(). Applied after fn. + |
+
+ None
+ |
+
check_name |
+
+ Union[str, None]
+ |
+
+
+
+ An optional name for the check to preface the result with. + |
+
+ '📏 Distributions'
+ |
+
**kwargs |
+
+ Any
+ |
+
+
+
+ Optional, additional arguments that are accepted by Pandas describe() method. + |
+
+ {}
+ |
+
Returns:
+Type | +Description | +
---|---|
+ DataFrame
+ |
+
+
+
+ The original DataFrame, unchanged. + |
+
disable_checks(enable_asserts=True)
+
+Turns off Pandas Checks globally, such as in production mode. Calls to .check functions will not be run. Does not modify the DataFrame itself.
+Args + enable_assert: Optionally, whether to also enable or disable assert statements
+ + +Returns:
+Type | +Description | +
---|---|
+ DataFrame
+ |
+
+
+
+ The original DataFrame, unchanged. + |
+
dtypes(fn=lambda df: df, subset=None, check_name='🗂️ Data types')
+
+Displays the data types of a DataFrame's columns without modifying the DataFrame itself.
+See Pandas docs for dtypes for additional usage information.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
fn |
+
+ Callable
+ |
+
+
+
+ An optional lambda function to apply to the DataFrame before running Pandas dtypes. Example: |
+
+ lambda df: df
+ |
+
subset |
+
+ Union[str, List, None]
+ |
+
+
+
+ An optional list of column names or a string to select a subset of columns before running Pandas .dtypes. Applied after fn. + |
+
+ None
+ |
+
check_name |
+
+ Union[str, None]
+ |
+
+
+
+ An optional name for the check to preface the result with. + |
+
+ '🗂️ Data types'
+ |
+
Returns:
+Type | +Description | +
---|---|
+ DataFrame
+ |
+
+
+
+ The original DataFrame, unchanged. + |
+
enable_checks(enable_asserts=True)
+
+Globally enables Pandas Checks. Subequent calls to .check methods will be run. Does not modify the DataFrame itself.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
enable_asserts |
+
+ bool
+ |
+
+
+
+ Optionally, whether to globally enable or disable calls to .check.assert_data(). + |
+
+ True
+ |
+
Returns:
+Type | +Description | +
---|---|
+ DataFrame
+ |
+
+
+
+ The original DataFrame, unchanged. + |
+
function(fn=lambda df: df, subset=None, check_name=None)
+
+Applies an arbitrary function on a DataFrame and shows the result, without modifying the DataFrame itself.
+ + +.check.function(fn=lambda df: df.shape[0]>10, check_name='Has at least 10 rows?') +which will result in 'True' or 'False'
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
fn |
+
+ Callable
+ |
+
+
+
+ A lambda function to apply to the DataFrame. Example: |
+
+ lambda df: df
+ |
+
subset |
+
+ Union[str, List, None]
+ |
+
+
+
+ An optional list of column names or a string to select a subset of columns before running Pandas describe(). Applied after fn. + |
+
+ None
+ |
+
check_name |
+
+ Union[str, None]
+ |
+
+
+
+ An optional name for the check to preface the result with. + |
+
+ None
+ |
+
Returns:
+Type | +Description | +
---|---|
+ DataFrame
+ |
+
+
+
+ The original DataFrame, unchanged. + |
+
get_mode(check_name='🐼🩺 Pandas Checks mode')
+
+Displays the current values of Pandas Checks global options enable_checks and enable_asserts. Does not modify the DataFrame itself.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
check_name |
+
+ Union[str, None]
+ |
+
+
+
+ An optional name for the check. Will be used as a preface the printed result. + |
+
+ '🐼🩺 Pandas Checks mode'
+ |
+
Returns:
+Type | +Description | +
---|---|
+ DataFrame
+ |
+
+
+
+ The original DataFrame, unchanged. + |
+
head(n=5, fn=lambda df: df, subset=None, check_name=None)
+
+Displays the first n rows of a DataFrame, without modifying the DataFrame itself.
+See Pandas docs for head() for additional usage information.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
n |
+
+ int
+ |
+
+
+
+ The number of rows to display. + |
+
+ 5
+ |
+
fn |
+
+ Callable
+ |
+
+
+
+ An optional lambda function to apply to the DataFrame before running Pandas head(). Example: |
+
+ lambda df: df
+ |
+
subset |
+
+ Union[str, List, None]
+ |
+
+
+
+ An optional list of column names or a string to select a subset of columns before running Pandas head(). Applied after fn. + |
+
+ None
+ |
+
check_name |
+
+ Union[str, None]
+ |
+
+
+
+ An optional name for the check, to be printed as preface to the result. + |
+
+ None
+ |
+
Returns:
+Type | +Description | +
---|---|
+ DataFrame
+ |
+
+
+
+ The original DataFrame, unchanged. + |
+
hist(fn=lambda df: df, subset=[], check_name=None, **kwargs)
+
+Displays a histogram for the DataFrame, without modifying the DataFrame itself.
+See Pandas docs for hist() for additional usage information, including more configuration options you can pass to this Pandas Checks method.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
fn |
+
+ Callable
+ |
+
+
+
+ An optional lambda function to apply to the DataFrame before running Pandas hist(). Example: |
+
+ lambda df: df
+ |
+
subset |
+
+ Union[str, List, None]
+ |
+
+
+
+ An optional list of column names or a string to select a subset of columns before running Pandas hist(). Applied after fn. + |
+
+ []
+ |
+
check_name |
+
+ Union[str, None]
+ |
+
+
+
+ An optional name for the check, to be printed as preface to the result. + |
+
+ None
+ |
+
**kwargs |
+
+ Any
+ |
+
+
+
+ Optional, additional arguments that are accepted by Pandas hist() method. + |
+
+ {}
+ |
+
Returns:
+Type | +Description | +
---|---|
+ DataFrame
+ |
+
+
+
+ The original DataFrame, unchanged. + |
+
If more than one column is passed, displays a grid of histograms
+Only renders in interactive mode (IPython/Jupyter), not in terminal
+info(fn=lambda df: df, subset=None, check_name='ℹ️ Info', **kwargs)
+
+Displays summary information about a DataFrame, without modifying the DataFrame itself.
+See Pandas docs for info() for additional usage information, including more configuration options you can pass to this Pandas Checks method.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
fn |
+
+ Callable
+ |
+
+
+
+ An optional lambda function to apply to the DataFrame before running Pandas info(). Example: |
+
+ lambda df: df
+ |
+
subset |
+
+ Union[str, List, None]
+ |
+
+
+
+ An optional list of column names or a string to select a subset of columns before running Pandas info(). Applied after fn. + |
+
+ None
+ |
+
check_name |
+
+ Union[str, None]
+ |
+
+
+
+ An optional name for the check, to be printed as preface to the result. + |
+
+ 'ℹ️ Info'
+ |
+
**kwargs |
+
+ Any
+ |
+
+
+
+ Optional, additional arguments that are accepted by Pandas info() method. + |
+
+ {}
+ |
+
Returns:
+Type | +Description | +
---|---|
+ DataFrame
+ |
+
+
+
+ The original DataFrame, unchanged. + |
+
memory_usage(fn=lambda df: df, subset=None, check_name='💾 Memory usage', **kwargs)
+
+Displays the memory footprint of a DataFrame, without modifying the DataFrame itself.
+See Pandas docs for memory_usage() for additional usage information, including more configuration options you can pass to this Pandas Checks method.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
fn |
+
+ Callable
+ |
+
+
+
+ An optional lambda function to apply to the DataFrame before running Pandas memory_usage(). Example: |
+
+ lambda df: df
+ |
+
subset |
+
+ Union[str, List, None]
+ |
+
+
+
+ An optional list of column names or a string to select a subset of columns before running Pandas memory_usage(). Applied after fn. + |
+
+ None
+ |
+
check_name |
+
+ Union[str, None]
+ |
+
+
+
+ An optional name for the check, to be printed as preface to the result. + |
+
+ '💾 Memory usage'
+ |
+
**kwargs |
+
+ Any
+ |
+
+
+
+ Optional, additional arguments that are accepted by Pandas info() method. + |
+
+ {}
+ |
+
Returns:
+Type | +Description | +
---|---|
+ DataFrame
+ |
+
+
+
+ The original DataFrame, unchanged. + |
+
Include argument deep=True
to get further memory usage of object dtypes in the DataFrame. See Pandas docs for memory_usage() for more info.
ncols(fn=lambda df: df, subset=None, check_name='🏛️ Columns')
+
+Displays the number of columns in a DataFrame, without modifying the DataFrame itself.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
fn |
+
+ Callable
+ |
+
+
+
+ An optional lambda function to apply to the DataFrame before counting the number of columns. Example: |
+
+ lambda df: df
+ |
+
subset |
+
+ Union[str, List, None]
+ |
+
+
+
+ An optional list of column names or a string to select a subset of columns before counting the number of columns. Applied after fn. + |
+
+ None
+ |
+
check_name |
+
+ Union[str, None]
+ |
+
+
+
+ An optional name for the check, to be printed as preface to the result. + |
+
+ '🏛️ Columns'
+ |
+
Returns:
+Type | +Description | +
---|---|
+ DataFrame
+ |
+
+
+
+ The original DataFrame, unchanged. + |
+
ndups(fn=lambda df: df, subset=None, check_name=None, **kwargs)
+
+Displays the number of duplicated rows in a DataFrame, without modifying the DataFrame itself.
+See Pandas docs for duplicated() for additional usage information, including more configuration options you can pass to this Pandas Checks method.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
fn |
+
+ Callable
+ |
+
+
+
+ An optional lambda function to apply to the DataFrame before counting the number of duplicates. Example: |
+
+ lambda df: df
+ |
+
subset |
+
+ Union[str, List, None]
+ |
+
+
+
+ An optional list of column names or a string to select a subset of columns before counting duplicate rows. Applied after fn. + |
+
+ None
+ |
+
check_name |
+
+ Union[str, None]
+ |
+
+
+
+ An optional name for the check, to be printed as preface to the result. + |
+
+ None
+ |
+
**kwargs |
+
+ Any
+ |
+
+
+
+ Optional, additional arguments that are accepted by Pandas duplicated() method. + |
+
+ {}
+ |
+
Returns:
+Type | +Description | +
---|---|
+ DataFrame
+ |
+
+
+
+ The original DataFrame, unchanged. + |
+
nnulls(fn=lambda df: df, subset=None, by_column=True, check_name='👻 Rows with NaNs')
+
+Displays the number of rows with null values in a DataFrame, without modifying the DataFrame itself.
+See Pandas docs for isna() for additional usage information.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
fn |
+
+ Callable
+ |
+
+
+
+ An optional lambda function to apply to the DataFrame before counting the number of rows with a null. Example: |
+
+ lambda df: df
+ |
+
subset |
+
+ Union[str, List, None]
+ |
+
+
+
+ An optional list of column names or a string to select a subset of columns before counting nulls. + |
+
+ None
+ |
+
by_column |
+
+ bool
+ |
+
+
+
+ If True, count null values with each column separately. If False, count rows with a null value in any column. Applied after fn. + |
+
+ True
+ |
+
check_name |
+
+ Union[str, None]
+ |
+
+
+
+ An optional name for the check, to be printed as preface to the result. + |
+
+ '👻 Rows with NaNs'
+ |
+
Returns:
+Type | +Description | +
---|---|
+ DataFrame
+ |
+
+
+
+ The original DataFrame, unchanged. + |
+
nrows(fn=lambda df: df, subset=None, check_name='☰ Rows')
+
+Displays the number of rows in a DataFrame, without modifying the DataFrame itself.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
fn |
+
+ Callable
+ |
+
+
+
+ An optional lambda function to apply to the DataFrame before counting the number of rows. Example: |
+
+ lambda df: df
+ |
+
subset |
+
+ Union[str, List, None]
+ |
+
+
+
+ An optional list of column names or a string name of one column to limit which columns are considered when counting rows. Applied after fn. + |
+
+ None
+ |
+
check_name |
+
+ Union[str, None]
+ |
+
+
+
+ An optional name for the check, to be printed as preface to the result. + |
+
+ '☰ Rows'
+ |
+
Returns:
+Type | +Description | +
---|---|
+ DataFrame
+ |
+
+
+
+ The original DataFrame, unchanged. + |
+
nunique(column, fn=lambda df: df, check_name=None, **kwargs)
+
+Displays the number of unique rows in a single column, without modifying the DataFrame itself.
+See Pandas docs for nunique() for additional usage information, including more configuration options you can pass to this Pandas Checks method.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
column |
+
+ str
+ |
+
+
+
+ The name of a column to count uniques in. Applied after fn. + |
+ + required + | +
fn |
+
+ Callable
+ |
+
+
+
+ An optional lambda function to apply to the DataFrame before running Pandas nunique(). Example: |
+
+ lambda df: df
+ |
+
check_name |
+
+ Union[str, None]
+ |
+
+
+
+ An optional name for the check, to be printed as preface to the result. + |
+
+ None
+ |
+
**kwargs |
+
+ Any
+ |
+
+
+
+ Optional, additional arguments that are accepted by Pandas nunique() method. + |
+
+ {}
+ |
+
Returns:
+Type | +Description | +
---|---|
+ DataFrame
+ |
+
+
+
+ The original DataFrame, unchanged. + |
+
plot(fn=lambda df: df, subset=None, check_name='', **kwargs)
+
+Displays a plot of the DataFrame, without modifying the DataFrame itself.
+See Pandas docs for plot() for additional usage information, including more configuration options you can pass to this Pandas Checks method.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
fn |
+
+ Callable
+ |
+
+
+
+ An optional lambda function to apply to the DataFrame before running Pandas plot(). Example: |
+
+ lambda df: df
+ |
+
subset |
+
+ Union[str, List, None]
+ |
+
+
+
+ An optional list of column names or a string name of one column to limit which columns are plotted. Applied after fn. + |
+
+ None
+ |
+
check_name |
+
+ Union[str, None]
+ |
+
+
+
+ An optional title for the plot. + |
+
+ ''
+ |
+
**kwargs |
+
+ Any
+ |
+
+
+
+ Optional, additional arguments that are accepted by Pandas plot() method. + |
+
+ {}
+ |
+
Returns:
+Type | +Description | +
---|---|
+ DataFrame
+ |
+
+
+
+ The original DataFrame, unchanged. + |
+
Plots are only displayed when code is run in IPython/Jupyter, not in terminal.
+If you pass a 'title' kwarg, it becomes the plot title, overriding check_name
+print(object=None, fn=lambda df: df, subset=None, check_name=None, max_rows=10)
+
+Displays text, another object, or (by default) the current DataFrame's head. Does not modify the DataFrame itself.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
object |
+
+ Any
+ |
+
+
+
+ Object to print. Can be anything printable: str, int, list, another DataFrame, etc. If None, print the DataFrame's head (with |
+
+ None
+ |
+
fn |
+
+ Callable
+ |
+
+
+
+ An optional lambda function to apply to the DataFrame before printing |
+
+ lambda df: df
+ |
+
subset |
+
+ Union[str, List, None]
+ |
+
+
+
+ An optional list of column names or a string name of one column to limit which columns are printed. Applied after fn. + |
+
+ None
+ |
+
check_name |
+
+ Union[str, None]
+ |
+
+
+
+ An optional name for the check, to be printed as preface to the result. + |
+
+ None
+ |
+
max_rows |
+
+ int
+ |
+
+
+
+ Maximum number of rows to print if object=None. + |
+
+ 10
+ |
+
Returns:
+Type | +Description | +
---|---|
+ DataFrame
+ |
+
+
+
+ The original DataFrame, unchanged. + |
+
print_time_elapsed(start_time, lead_in='Time elapsed', units='auto')
+
+Displays the time elapsed since start_time.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
start_time |
+
+ float
+ |
+
+
+
+ The index time when the stopwatch started, which comes from the Pandas Checks start_timer() + |
+ + required + | +
lead_in |
+
+ Union[str, None]
+ |
+
+
+
+ Optional text to print before the elapsed time. + |
+
+ 'Time elapsed'
+ |
+
units |
+
+ str
+ |
+
+
+
+ The units in which to display the elapsed time. Can be "auto", "seconds", "minutes", or "hours". + |
+
+ 'auto'
+ |
+
Raises:
+Type | +Description | +
---|---|
+ ValueError
+ |
+
+
+
+ If |
+
Returns:
+Type | +Description | +
---|---|
+ DataFrame
+ |
+
+
+
+ The original DataFrame, unchanged. + |
+
reset_format()
+
+Globally restores all Pandas Checks formatting options to their default "factory" settings. Does not modify the DataFrame itself.
+ + +Returns:
+Type | +Description | +
---|---|
+ DataFrame
+ |
+
+
+
+ The original DataFrame, unchanged. + |
+
set_format(**kwargs)
+
+Configures selected formatting options for Pandas Checks. Does not modify the DataFrame itself.
+Run pandas_checks.describe_options() to see a list of available options.
+For example, .check.set_format(check_text_tag= "h1", use_emojis=False`) +will globally change Pandas Checks to display text results as H1 headings and remove all emojis.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
**kwargs |
+
+ Any
+ |
+
+
+
+ Pairs of setting name and its new value. + |
+
+ {}
+ |
+
Returns:
+Type | +Description | +
---|---|
+ DataFrame
+ |
+
+
+
+ The original DataFrame, unchanged. + |
+
set_mode(enable_checks, enable_asserts)
+
+Configures the operation mode for Pandas Checks globally. Does not modify the DataFrame itself.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
enable_checks |
+
+ bool
+ |
+
+
+
+ Whether to run any Pandas Checks methods globally. Does not affect .check.assert_data(). + |
+ + required + | +
enable_asserts |
+
+ bool
+ |
+
+
+
+ Whether to run calls to Pandas Checks .check.assert_data() statements globally. + |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ DataFrame
+ |
+
+
+
+ The original DataFrame, unchanged. + |
+
shape(fn=lambda df: df, subset=None, check_name='📐 Shape')
+
+Displays the Dataframe's dimensions, without modifying the DataFrame itself.
+See Pandas docs for shape for additional usage information.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
fn |
+
+ Callable
+ |
+
+
+
+ An optional lambda function to apply to the DataFrame before running Pandas |
+
+ lambda df: df
+ |
+
subset |
+
+ Union[str, List, None]
+ |
+
+
+
+ An optional list of column names or a string name of one column to limit which columns are considered when printing the shape. Applied after fn. + |
+
+ None
+ |
+
check_name |
+
+ Union[str, None]
+ |
+
+
+
+ An optional name for the check, to be printed as preface to the result. + |
+
+ '📐 Shape'
+ |
+
Returns:
+Type | +Description | +
---|---|
+ DataFrame
+ |
+
+
+
+ The original DataFrame, unchanged. + |
+
See also .check.nrows() and .check.ncols()
+tail(n=5, fn=lambda df: df, subset=None, check_name=None)
+
+Displays the last n rows of the DataFrame, without modifying the DataFrame itself.
+See Pandas docs for tail() for additional usage information, including more configuration options you can pass to this Pandas Checks method.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
n |
+
+ int
+ |
+
+
+
+ Number of rows to show. + |
+
+ 5
+ |
+
fn |
+
+ Callable
+ |
+
+
+
+ An optional lambda function to apply to the DataFrame before running Pandas tail(). Example: |
+
+ lambda df: df
+ |
+
subset |
+
+ Union[str, List, None]
+ |
+
+
+
+ An optional list of column names or a string name of one column to limit which columns are displayed. Applied after fn. + |
+
+ None
+ |
+
check_name |
+
+ Union[str, None]
+ |
+
+
+
+ An optional name for the check, to be printed as preface to the result. + |
+
+ None
+ |
+
Returns:
+Type | +Description | +
---|---|
+ DataFrame
+ |
+
+
+
+ The original DataFrame, unchanged. + |
+
unique(column, fn=lambda df: df, check_name=None)
+
+Displays the unique values in a column, without modifying the DataFrame itself.
+See Pandas docs for unique() for additional usage information, including more configuration options you can pass to this Pandas Checks method.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
column |
+
+ str
+ |
+
+
+
+ Column to check for unique values. + |
+ + required + | +
fn |
+
+ Callable
+ |
+
+
+
+ An optional lambda function to apply to the DataFrame before calling Pandas unique(). Example: |
+
+ lambda df: df
+ |
+
check_name |
+
+ Union[str, None]
+ |
+
+
+
+ An optional name for the check, to be printed as preface to the result. + |
+
+ None
+ |
+
Returns:
+Type | +Description | +
---|---|
+ DataFrame
+ |
+
+
+
+ The original DataFrame, unchanged. + |
+
fn
is applied to the dataframe before selecting column
. If you want to select the column before modifying it, set column=None
and start fn
with a column selection, i.e. fn=lambda df: df["my_column"].stuff()
value_counts(column, fn=lambda df: df, max_rows=10, check_name=None, **kwargs)
+
+Displays the value counts for a column, without modifying the DataFrame itself.
+See Pandas docs for value_counts() for additional usage information, including more configuration options you can pass to this Pandas Checks method.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
column |
+
+ str
+ |
+
+
+
+ Column to check for value counts. + |
+ + required + | +
max_rows |
+
+ int
+ |
+
+
+
+ Maximum number of rows to show in the value counts. + |
+
+ 10
+ |
+
fn |
+
+ Callable
+ |
+
+
+
+ An optional lambda function to apply to the DataFrame before running Pandas value_counts(). Example: |
+
+ lambda df: df
+ |
+
check_name |
+
+ Union[str, None]
+ |
+
+
+
+ An optional name for the check, to be printed as preface to the result. + |
+
+ None
+ |
+
**kwargs |
+
+ Any
+ |
+
+
+
+ Optional, additional arguments that are accepted by Pandas value_counts() method. + |
+
+ {}
+ |
+
Returns:
+Type | +Description | +
---|---|
+ DataFrame
+ |
+
+
+
+ The original DataFrame, unchanged. + |
+
fn
is applied to the dataframe before selecting column
. If you want to select the column before modifying it, set column=None
and start fn
with a column selection, i.e. fn=lambda df: df["my_column"].stuff()
write(path, format=None, fn=lambda df: df, subset=None, verbose=False, **kwargs)
+
+Exports DataFrame to file, without modifying the DataFrame itself.
+Format is inferred from path extension like .csv.
+This functions uses the corresponding Pandas export function such as to_csv(). See Pandas docs for those functions for additional usage information, including more configuration options you can pass to this Pandas Checks method.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
path |
+
+ str
+ |
+
+
+
+ Path to write the file to. + |
+ + required + | +
format |
+
+ Union[str, None]
+ |
+
+
+
+ Optional file format to force for the export. If None, format is inferred from the file's extension in |
+
+ None
+ |
+
fn |
+
+ Callable
+ |
+
+
+
+ An optional lambda function to apply to the DataFrame before exporting. Example: |
+
+ lambda df: df
+ |
+
subset |
+
+ Union[str, List, None]
+ |
+
+
+
+ An optional list of column names or a string name of one column to limit which columns are exported. Applied after fn. + |
+
+ None
+ |
+
verbose |
+
+ bool
+ |
+
+
+
+ Whether to print a message when the file is written. + |
+
+ False
+ |
+
**kwargs |
+
+ Any
+ |
+
+
+
+ Optional, additional keyword arguments to pass to the Pandas export function (.to_csv). + |
+
+ {}
+ |
+
Returns:
+Type | +Description | +
---|---|
+ DataFrame
+ |
+
+
+
+ The original DataFrame, unchanged. + |
+
Exporting to some formats such as Excel, Feather, and Parquet may require you to install additional packages.
+_obj = pandas_obj
+
+
+ instance-attribute
+
+
+__init__(pandas_obj)
+
+assert_data(condition, pass_message=' ✔️ Assertion passed ', fail_message=' ㄨ Assertion failed ', raise_exception=True, exception_to_raise=DataError, message_shows_condition=True, verbose=False)
+
+Tests whether Series meets condition. Optionally raises an exception. Does not modify the Series itself.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
condition |
+
+ Callable
+ |
+
+
+
+ Assertion criteria in the form of a lambda function, such as |
+ + required + | +
pass_message |
+
+ str
+ |
+
+
+
+ Message to display if the condition passes. + |
+
+ ' ✔️ Assertion passed '
+ |
+
fail_message |
+
+ str
+ |
+
+
+
+ Message to display if the condition fails. + |
+
+ ' ㄨ Assertion failed '
+ |
+
raise_exception |
+
+ bool
+ |
+
+
+
+ Whether to raise an exception if the condition fails. + |
+
+ True
+ |
+
exception_to_raise |
+
+ Type[BaseException]
+ |
+
+
+
+ The exception to raise if the condition fails and raise_exception is True. + |
+
+ DataError
+ |
+
message_shows_condition |
+
+ bool
+ |
+
+
+
+ Whether the fail/pass message should also print the assertion criteria + |
+
+ True
+ |
+
verbose |
+
+ bool
+ |
+
+
+
+ Whether to display the pass message if the condition passes. + |
+
+ False
+ |
+
Returns:
+Type | +Description | +
---|---|
+ Series
+ |
+
+
+
+ The original Series, unchanged. + |
+
assert_datetime(pass_message=' ✔️ Assert datetime passed ', fail_message=None, raise_exception=True, exception_to_raise=TypeError, verbose=False)
+
+Tests whether Series is datetime or timestamp. Optionally raises an exception. Does not modify the Series itself.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
pass_message |
+
+ str
+ |
+
+
+
+ Message to display if the condition passes. + |
+
+ ' ✔️ Assert datetime passed '
+ |
+
fail_message |
+
+ Union[str, None]
+ |
+
+
+
+ Message to display if the condition fails. + |
+
+ None
+ |
+
raise_exception |
+
+ bool
+ |
+
+
+
+ Whether to raise an exception if the condition fails. + |
+
+ True
+ |
+
exception_to_raise |
+
+ Type[BaseException]
+ |
+
+
+
+ The exception to raise if the condition fails and raise_exception is True. + |
+
+ TypeError
+ |
+
verbose |
+
+ bool
+ |
+
+
+
+ Whether to display the pass message if the condition passes. + |
+
+ False
+ |
+
Returns:
+Type | +Description | +
---|---|
+ Series
+ |
+
+
+
+ The original Series, unchanged. + |
+
assert_float(pass_message=' ✔️ Assert float passed ', fail_message=None, raise_exception=True, exception_to_raise=TypeError, verbose=False)
+
+Tests whether Series is floats. Optionally raises an exception. Does not modify the Series itself.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
pass_message |
+
+ str
+ |
+
+
+
+ Message to display if the condition passes. + |
+
+ ' ✔️ Assert float passed '
+ |
+
fail_message |
+
+ Union[str, None]
+ |
+
+
+
+ Message to display if the condition fails. + |
+
+ None
+ |
+
raise_exception |
+
+ bool
+ |
+
+
+
+ Whether to raise an exception if the condition fails. + |
+
+ True
+ |
+
exception_to_raise |
+
+ Type[BaseException]
+ |
+
+
+
+ The exception to raise if the condition fails and raise_exception is True. + |
+
+ TypeError
+ |
+
verbose |
+
+ bool
+ |
+
+
+
+ Whether to display the pass message if the condition passes. + |
+
+ False
+ |
+
Returns:
+Type | +Description | +
---|---|
+ Series
+ |
+
+
+
+ The original Series, unchanged. + |
+
assert_greater_than(min, or_equal_to=True, pass_message=' ✔️ Assert minimum passed ', fail_message=' ㄨ Assert minimum failed ', raise_exception=True, exception_to_raise=DataError, verbose=False)
+
+Tests whether Series is > or >= a value. Optionally raises an exception. Does not modify the Series itself.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
min |
+
+ Any
+ |
+
+
+
+ the minimum value to compare Series to. Accepts any type that can be used in >, such as int, float, str, datetime + |
+ + required + | +
or_equal_to |
+
+ bool
+ |
+
+
+
+ whether to test for >= min (True) or > min (False) + |
+
+ True
+ |
+
pass_message |
+
+ str
+ |
+
+
+
+ Message to display if the condition passes. + |
+
+ ' ✔️ Assert minimum passed '
+ |
+
fail_message |
+
+ str
+ |
+
+
+
+ Message to display if the condition fails. + |
+
+ ' ㄨ Assert minimum failed '
+ |
+
raise_exception |
+
+ bool
+ |
+
+
+
+ Whether to raise an exception if the condition fails. + |
+
+ True
+ |
+
exception_to_raise |
+
+ Type[BaseException]
+ |
+
+
+
+ The exception to raise if the condition fails and raise_exception is True. + |
+
+ DataError
+ |
+
verbose |
+
+ bool
+ |
+
+
+
+ Whether to display the pass message if the condition passes. + |
+
+ False
+ |
+
Returns:
+Type | +Description | +
---|---|
+ Series
+ |
+
+
+
+ The original Series, unchanged. + |
+
assert_int(pass_message=' ✔️ Assert integeer passed ', fail_message=None, raise_exception=True, exception_to_raise=TypeError, verbose=False)
+
+Tests whether Series is integers. Optionally raises an exception. Does not modify the Series itself.
+Args:
+pass_message: Message to display if the condition passes.
+fail_message: Message to display if the condition fails.
+raise_exception: Whether to raise an exception if the condition fails.
+exception_to_raise: The exception to raise if the condition fails and raise_exception is True.
+verbose: Whether to display the pass message if the condition passes.
+
+
+
+ Returns:
+Type | +Description | +
---|---|
+ Series
+ |
+
+
+
+ The original Series, unchanged. + |
+
assert_less_than(max, or_equal_to=True, pass_message=' ✔️ Assert maximum passed ', fail_message=' ㄨ Assert maximum failed ', raise_exception=True, exception_to_raise=DataError, verbose=False)
+
+Tests whether Series is < or <= a value. Optionally raises an exception. Does not modify the Series itself.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
max |
+
+ Any
+ |
+
+
+
+ the max value to compare Series to. Accepts any type that can be used in <, such as int, float, str, datetime + |
+ + required + | +
or_equal_to |
+
+ bool
+ |
+
+
+
+ whether to test for <= min (True) or < max (False) + |
+
+ True
+ |
+
pass_message |
+
+ str
+ |
+
+
+
+ Message to display if the condition passes. + |
+
+ ' ✔️ Assert maximum passed '
+ |
+
fail_message |
+
+ str
+ |
+
+
+
+ Message to display if the condition fails. + |
+
+ ' ㄨ Assert maximum failed '
+ |
+
raise_exception |
+
+ bool
+ |
+
+
+
+ Whether to raise an exception if the condition fails. + |
+
+ True
+ |
+
exception_to_raise |
+
+ Type[BaseException]
+ |
+
+
+
+ The exception to raise if the condition fails and raise_exception is True. + |
+
+ DataError
+ |
+
verbose |
+
+ bool
+ |
+
+
+
+ Whether to display the pass message if the condition passes. + |
+
+ False
+ |
+
Returns:
+Type | +Description | +
---|---|
+ Series
+ |
+
+
+
+ The original Series, unchanged. + |
+
assert_negative(assert_not_null=True, pass_message=' ✔️ Assert negative passed ', fail_message=' ㄨ Assert negative failed ', raise_exception=True, exception_to_raise=DataError, verbose=False)
+
+Tests whether Series has all negative values. Optionally raises an exception. Does not modify the Series itself.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
assert_not_null |
+
+ bool
+ |
+
+
+
+ Whether to also enforce that data has no nulls. + |
+
+ True
+ |
+
pass_message |
+
+ str
+ |
+
+
+
+ Message to display if the condition passes. + |
+
+ ' ✔️ Assert negative passed '
+ |
+
fail_message |
+
+ str
+ |
+
+
+
+ Message to display if the condition fails. + |
+
+ ' ㄨ Assert negative failed '
+ |
+
raise_exception |
+
+ bool
+ |
+
+
+
+ Whether to raise an exception if the condition fails. + |
+
+ True
+ |
+
exception_to_raise |
+
+ Type[BaseException]
+ |
+
+
+
+ The exception to raise if the condition fails and raise_exception is True. + |
+
+ DataError
+ |
+
verbose |
+
+ bool
+ |
+
+
+
+ Whether to display the pass message if the condition passes. + |
+
+ False
+ |
+
Returns:
+Type | +Description | +
---|---|
+ Series
+ |
+
+
+
+ The original Series, unchanged. + |
+
assert_not_null(pass_message=' ✔️ Assert no nulls passed ', fail_message=' ㄨ Assert no nulls failed ', raise_exception=True, exception_to_raise=DataError, verbose=False)
+
+Tests whether Series has no nulls. Optionally raises an exception. Does not modify the Series itself.
+Args:
+pass_message: Message to display if the condition passes.
+fail_message: Message to display if the condition fails.
+raise_exception: Whether to raise an exception if the condition fails.
+exception_to_raise: The exception to raise if the condition fails and raise_exception is True.
+verbose: Whether to display the pass message if the condition passes.
+
+
+
+ Returns:
+Type | +Description | +
---|---|
+ Series
+ |
+
+
+
+ The original Series, unchanged. + |
+
assert_null(pass_message=' ✔️ Assert all nulls passed ', fail_message=' ㄨ Assert all nulls failed ', raise_exception=True, exception_to_raise=DataError, verbose=False)
+
+Tests whether Series has all nulls. Optionally raises an exception. Does not modify the Series itself.
+Args:
+pass_message: Message to display if the condition passes.
+fail_message: Message to display if the condition fails.
+raise_exception: Whether to raise an exception if the condition fails.
+exception_to_raise: The exception to raise if the condition fails and raise_exception is True.
+verbose: Whether to display the pass message if the condition passes.
+
+
+
+ Returns:
+Type | +Description | +
---|---|
+ Series
+ |
+
+
+
+ The original Series, unchanged. + |
+
assert_positive(assert_not_null=True, pass_message=' ✔️ Assert positive passed ', fail_message=' ㄨ Assert positive failed ', raise_exception=True, exception_to_raise=DataError, verbose=False)
+
+Tests whether Series has all positive values. Optionally raises an exception. Does not modify the Series itself.
+Args:
+assert_not_null: Whether to also enforce that data has no nulls.
+pass_message: Message to display if the condition passes.
+fail_message: Message to display if the condition fails.
+raise_exception: Whether to raise an exception if the condition fails.
+exception_to_raise: The exception to raise if the condition fails and raise_exception is True.
+verbose: Whether to display the pass message if the condition passes.
+
+
+
+ Returns:
+Type | +Description | +
---|---|
+ Series
+ |
+
+
+
+ The original Series, unchanged. + |
+
assert_str(pass_message=' ✔️ Assert string passed ', fail_message=None, raise_exception=True, exception_to_raise=TypeError, verbose=False)
+
+Tests whether Series is strings. Optionally raises an exception. Does not modify the Series itself.
+Args:
+pass_message: Message to display if the condition passes.
+fail_message: Message to display if the condition fails.
+raise_exception: Whether to raise an exception if the condition fails.
+exception_to_raise: The exception to raise if the condition fails and raise_exception is True.
+verbose: Whether to display the pass message if the condition passes.
+
+
+
+ Returns:
+Type | +Description | +
---|---|
+ Series
+ |
+
+
+
+ The original Series, unchanged. + |
+
assert_timedelta(pass_message=' ✔️ Assert timedelta passed ', fail_message=None, raise_exception=True, exception_to_raise=TypeError, verbose=False)
+
+Tests whether Series is of type timedelta. Optionally raises an exception. Does not modify the Series itself.
+Args:
+pass_message: Message to display if the condition passes.
+fail_message: Message to display if the condition fails.
+raise_exception: Whether to raise an exception if the condition fails.
+exception_to_raise: The exception to raise if the condition fails and raise_exception is True.
+verbose: Whether to display the pass message if the condition passes.
+
+
+
+ Returns:
+Type | +Description | +
---|---|
+ Series
+ |
+
+
+
+ The original Series, unchanged. + |
+
assert_type(dtype, pass_message=' ✔️ Assert type passed ', fail_message=None, raise_exception=True, exception_to_raise=TypeError, verbose=False)
+
+Tests whether Series meets type assumption. Optionally raises an exception. Does not modify the Series itself.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
dtype |
+
+ Type[Any]
+ |
+
+
+
+ The required variable type + |
+ + required + | +
pass_message |
+
+ str
+ |
+
+
+
+ Message to display if the condition passes. + |
+
+ ' ✔️ Assert type passed '
+ |
+
fail_message |
+
+ Union[str, None]
+ |
+
+
+
+ Message to display if the condition fails. + |
+
+ None
+ |
+
raise_exception |
+
+ bool
+ |
+
+
+
+ Whether to raise an exception if the condition fails. + |
+
+ True
+ |
+
exception_to_raise |
+
+ Type[BaseException]
+ |
+
+
+
+ The exception to raise if the condition fails and raise_exception is True. + |
+
+ TypeError
+ |
+
verbose |
+
+ bool
+ |
+
+
+
+ Whether to display the pass message if the condition passes. + |
+
+ False
+ |
+
Returns:
+Type | +Description | +
---|---|
+ Series
+ |
+
+
+
+ The original Series, unchanged. + |
+
assert_unique(pass_message=' ✔️ Assert unique passed ', fail_message=' ㄨ Assert unique failed ', raise_exception=True, exception_to_raise=DataError, verbose=False)
+
+Tests whether Series has no duplicate rows. Optionally raises an exception. Does not modify the Series itself.
+Args:
+pass_message: Message to display if the condition passes.
+fail_message: Message to display if the condition fails.
+raise_exception: Whether to raise an exception if the condition fails.
+exception_to_raise: The exception to raise if the condition fails and raise_exception is True.
+verbose: Whether to display the pass message if the condition passes.
+
+
+
+ Returns:
+Type | +Description | +
---|---|
+ Series
+ |
+
+
+
+ The original Series, unchanged. + |
+
describe(fn=lambda s: s, check_name='📏 Distribution', **kwargs)
+
+Displays descriptive statistics about a Series, without modifying the Series itself.
+See Pandas docs for describe() for additional usage information, including more configuration options you can pass to this Pandas Checks method.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
fn |
+
+ Callable
+ |
+
+
+
+ An optional lambda function to apply to the Series before running Pandas describe(). Example: |
+
+ lambda s: s
+ |
+
check_name |
+
+ Union[str, None]
+ |
+
+
+
+ An optional name for the check to preface the result with. + |
+
+ '📏 Distribution'
+ |
+
**kwargs |
+
+ Any
+ |
+
+
+
+ Optional, additional arguments that are accepted by Pandas describe() method. + |
+
+ {}
+ |
+
Returns:
+Type | +Description | +
---|---|
+ Series
+ |
+
+
+
+ The original Series, unchanged. + |
+
disable_checks(enable_asserts=True)
+
+Turns off Pandas Checks globally, such as in production mode. Calls to .check functions will not be run. Does not modify the Series itself.
+Args + enable_assert: Optionally, whether to also enable or disable assert statements
+ + +Returns:
+Type | +Description | +
---|---|
+ Series
+ |
+
+
+
+ The original Series, unchanged. + |
+
dtype(fn=lambda s: s, check_name='🗂️ Data type')
+
+Displays the data type of a Series, without modifying the Series itself.
+See Pandas docs for .dtype for additional usage information.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
fn |
+
+ Callable
+ |
+
+
+
+ An optional lambda function to apply to the Series before running Pandas dtype. Example: |
+
+ lambda s: s
+ |
+
check_name |
+
+ Union[str, None]
+ |
+
+
+
+ An optional name for the check to preface the result with. + |
+
+ '🗂️ Data type'
+ |
+
Returns:
+Type | +Description | +
---|---|
+ Series
+ |
+
+
+
+ The original Series, unchanged. + |
+
enable_checks(enable_asserts=True)
+
+Globally enables Pandas Checks. Subequent calls to .check methods will be run. Does not modify the Series itself.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
enable_asserts |
+
+ bool
+ |
+
+
+
+ Optionally, whether to globally enable or disable calls to .check.assert_data(). + |
+
+ True
+ |
+
Returns:
+Type | +Description | +
---|---|
+ Series
+ |
+
+
+
+ The original Series, unchanged. + |
+
function(fn=lambda s: s, check_name=None)
+
+Applies an arbitrary function on a Series and shows the result, without modifying the Series itself.
+ + +.check.function(fn=lambda s: s.shape[0]>10, check_name='Has at least 10 rows?') +which will result in 'True' or 'False'
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
fn |
+
+ Callable
+ |
+
+
+
+ The lambda function to apply to the Series. Example: |
+
+ lambda s: s
+ |
+
check_name |
+
+ Union[str, None]
+ |
+
+
+
+ An optional name for the check to preface the result with. + |
+
+ None
+ |
+
Returns:
+Type | +Description | +
---|---|
+ Series
+ |
+
+
+
+ The original Series, unchanged. + |
+
get_mode(check_name='⚙️ Pandas Checks mode')
+
+Displays the current values of Pandas Checks global options enable_checks and enable_asserts. Does not modify the Series itself.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
check_name |
+
+ Union[str, None]
+ |
+
+
+
+ An optional name for the check. Will be used as a preface the printed result. + |
+
+ '⚙️ Pandas Checks mode'
+ |
+
Returns:
+Type | +Description | +
---|---|
+ Series
+ |
+
+
+
+ The original Series, unchanged. + |
+
head(n=5, fn=lambda s: s, check_name=None)
+
+Displays the first n rows of a Series, without modifying the Series itself.
+See Pandas docs for head() for additional usage information.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
n |
+
+ int
+ |
+
+
+
+ The number of rows to display. + |
+
+ 5
+ |
+
fn |
+
+ Callable
+ |
+
+
+
+ An optional lambda function to apply to the Series before running Pandas head(). Example: |
+
+ lambda s: s
+ |
+
check_name |
+
+ Union[str, None]
+ |
+
+
+
+ An optional name for the check, to be printed as preface to the result. + |
+
+ None
+ |
+
Returns:
+Type | +Description | +
---|---|
+ Series
+ |
+
+
+
+ The original Series, unchanged. + |
+
hist(fn=lambda s: s, check_name=None, **kwargs)
+
+Displays a histogram for the Series's distribution, without modifying the Series itself.
+See Pandas docs for hist() for additional usage information, including more configuration options you can pass to this Pandas Checks method.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
fn |
+
+ Callable
+ |
+
+
+
+ An optional lambda function to apply to the Series before running Pandas head(). Example: |
+
+ lambda s: s
+ |
+
check_name |
+
+ Union[str, None]
+ |
+
+
+
+ An optional name for the check, to be printed as preface to the result. + |
+
+ None
+ |
+
**kwargs |
+
+ Any
+ |
+
+
+
+ Optional, additional arguments that are accepted by Pandas hist() method. + |
+
+ {}
+ |
+
Returns:
+Type | +Description | +
---|---|
+ Series
+ |
+
+
+
+ The original Series, unchanged. + |
+
Plots are only displayed when code is run in IPython/Jupyter, not in terminal.
+info(fn=lambda s: s, check_name='ℹ️ Series info', **kwargs)
+
+Displays summary information about a Series, without modifying the Series itself.
+See Pandas docs for info() for additional usage information, including more configuration options you can pass to this Pandas Checks method.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
fn |
+
+ Callable
+ |
+
+
+
+ An optional lambda function to apply to the Series before running Pandas info(). Example: |
+
+ lambda s: s
+ |
+
check_name |
+
+ Union[str, None]
+ |
+
+
+
+ An optional name for the check, to be printed as preface to the result. + |
+
+ 'ℹ️ Series info'
+ |
+
**kwargs |
+
+ Any
+ |
+
+
+
+ Optional, additional arguments that are accepted by Pandas info() method. + |
+
+ {}
+ |
+
Returns:
+Type | +Description | +
---|---|
+ Series
+ |
+
+
+
+ The original Series, unchanged. + |
+
memory_usage(fn=lambda s: s, check_name='💾 Memory usage', **kwargs)
+
+Displays the memory footprint of a Series, without modifying the Series itself.
+See Pandas docs for memory_usage() for additional usage information, including more configuration options you can pass to this Pandas Checks method.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
fn |
+
+ Callable
+ |
+
+
+
+ An optional lambda function to apply to the Series before running Pandas memory_usage(). Example: |
+
+ lambda s: s
+ |
+
check_name |
+
+ Union[str, None]
+ |
+
+
+
+ An optional name for the check, to be printed as preface to the result. + |
+
+ '💾 Memory usage'
+ |
+
**kwargs |
+
+ Any
+ |
+
+
+
+ Optional, additional arguments that are accepted by Pandas memory_usage() method. + |
+
+ {}
+ |
+
Returns:
+Type | +Description | +
---|---|
+ Series
+ |
+
+
+
+ The original Series, unchanged. + |
+
Include argument deep=True
to get further memory usage of object dtypes. See Pandas docs for memory_usage() for more info.
ndups(fn=lambda s: s, check_name=None, **kwargs)
+
+Displays the number of duplicated rows in the Series, without modifying the Series itself.
+See Pandas docs for duplicated() for additional usage information, including more configuration options you can pass to this Pandas Checks method.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
fn |
+
+ Callable
+ |
+
+
+
+ An optional lambda function to apply to the Series before counting the number of duplicates. Example: |
+
+ lambda s: s
+ |
+
check_name |
+
+ Union[str, None]
+ |
+
+
+
+ An optional name for the check, to be printed as preface to the result. + |
+
+ None
+ |
+
**kwargs |
+
+ Any
+ |
+
+
+
+ Optional, additional arguments that are accepted by Pandas duplicated() method. + |
+
+ {}
+ |
+
Returns:
+Type | +Description | +
---|---|
+ Series
+ |
+
+
+
+ The original Series, unchanged. + |
+
nnulls(fn=lambda s: s, check_name='👻 Rows with NaNs')
+
+Displays the number of rows with null values in the Series, without modifying the Series itself.
+See Pandas docs for isna() for additional usage information.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
fn |
+
+ Callable
+ |
+
+
+
+ An optional lambda function to apply to the Series before counting rows with nulls. Example: |
+
+ lambda s: s
+ |
+
check_name |
+
+ Union[str, None]
+ |
+
+
+
+ An optional name for the check, to be printed as preface to the result. + |
+
+ '👻 Rows with NaNs'
+ |
+
Returns:
+Type | +Description | +
---|---|
+ Series
+ |
+
+
+
+ The original Series, unchanged. + |
+
nrows(fn=lambda s: s, check_name='☰ Rows')
+
+Displays the number of rows in a Series, without modifying the Series itself.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
fn |
+
+ Callable
+ |
+
+
+
+ An optional lambda function to apply to the Series before counting the number of rows. Example: |
+
+ lambda s: s
+ |
+
check_name |
+
+ Union[str, None]
+ |
+
+
+
+ An optional name for the check, to be printed as preface to the result. + |
+
+ '☰ Rows'
+ |
+
Returns:
+Type | +Description | +
---|---|
+ Series
+ |
+
+
+
+ The original Series, unchanged. + |
+
nunique(fn=lambda s: s, check_name=None, **kwargs)
+
+Displays the number of unique rows in a Series, without modifying the Series itself.
+See Pandas docs for nunique() for additional usage information, including more configuration options you can pass to this Pandas Checks method.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
fn |
+
+ Callable
+ |
+
+
+
+ An optional lambda function to apply to the Series before running Pandas nunique(). Example: |
+
+ lambda s: s
+ |
+
check_name |
+
+ Union[str, None]
+ |
+
+
+
+ An optional name for the check, to be printed as preface to the result. + |
+
+ None
+ |
+
**kwargs |
+
+ Any
+ |
+
+
+
+ Optional, additional arguments that are accepted by Pandas nunique() method. + |
+
+ {}
+ |
+
Returns:
+Type | +Description | +
---|---|
+ Series
+ |
+
+
+
+ The original Series, unchanged. + |
+
plot(fn=lambda s: s, check_name='', **kwargs)
+
+Displays a plot of the Series, without modifying the Series itself.
+See Pandas docs for plot() for additional usage information, including more configuration options you can pass to this Pandas Checks method.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
fn |
+
+ Callable
+ |
+
+
+
+ An optional lambda function to apply to the Series before running Pandas plot(). Example: |
+
+ lambda s: s
+ |
+
check_name |
+
+ Union[str, None]
+ |
+
+
+
+ An optional title for the plot. + |
+
+ ''
+ |
+
**kwargs |
+
+ Any
+ |
+
+
+
+ Optional, additional arguments that are accepted by Pandas plot() method. + |
+
+ {}
+ |
+
Returns:
+Type | +Description | +
---|---|
+ Series
+ |
+
+
+
+ The original Series, unchanged. + |
+
Plots are only displayed when code is run in IPython/Jupyter, not in terminal.
+If you pass a 'title' kwarg, it becomes the plot title, overriding check_name
+print(object=None, fn=lambda s: s, check_name=None, max_rows=10)
+
+Displays text, another object, or (by default) the current DataFrame's head. Does not modify the Series itself.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
object |
+
+ Any
+ |
+
+
+
+ Object to print. Can be anything printable: str, int, list, another DataFrame, etc. If None, print the Series's head (with |
+
+ None
+ |
+
fn |
+
+ Callable
+ |
+
+
+
+ An optional lambda function to apply to the Series before printing |
+
+ lambda s: s
+ |
+
check_name |
+
+ Union[str, None]
+ |
+
+
+
+ An optional name for the check, to be printed as preface to the result. + |
+
+ None
+ |
+
max_rows |
+
+ int
+ |
+
+
+
+ Maximum number of rows to print if object=None. + |
+
+ 10
+ |
+
Returns:
+Type | +Description | +
---|---|
+ Series
+ |
+
+
+
+ The original Series, unchanged. + |
+
print_time_elapsed(start_time, lead_in='Time elapsed', units='auto')
+
+Displays the time elapsed since start_time.
+Args: +start_time: The index time when the stopwatch started, which comes from the Pandas Checks start_timer() +lead_in: Optional text to print before the elapsed time. +units: The units in which to display the elapsed time. Can be "auto", "seconds", "minutes", or "hours".
+ + +Raises:
+Type | +Description | +
---|---|
+ ValueError
+ |
+
+
+
+ If |
+
Returns:
+Type | +Description | +
---|---|
+ Series
+ |
+
+
+
+ The original Series, unchanged. + |
+
reset_format()
+
+Globally restores all Pandas Checks formatting options to their default "factory" settings. Does not modify the Series itself.
+ + +Returns:
+Type | +Description | +
---|---|
+ Series
+ |
+
+
+
+ The original Series, unchanged. + |
+
set_format(**kwargs)
+
+Configures selected formatting options for Pandas Checks. Run pandas_checks.describe_options() to see a list of available options. Does not modify the Series itself
+For example, .check.set_format(check_text_tag= "h1", use_emojis=False`) +will globally change Pandas Checks to display text results as H1 headings and remove all emojis.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
**kwargs |
+
+ Any
+ |
+
+
+
+ Pairs of setting name and its new value. + |
+
+ {}
+ |
+
Returns:
+Type | +Description | +
---|---|
+ Series
+ |
+
+
+
+ The original Series, unchanged. + |
+
set_mode(enable_checks, enable_asserts)
+
+Configures the operation mode for Pandas Checks globally. Does not modify the Series itself.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
enable_checks |
+
+ bool
+ |
+
+
+
+ Whether to run any Pandas Checks methods globally. Does not affect .check.assert_data(). + |
+ + required + | +
enable_asserts |
+
+ bool
+ |
+
+
+
+ Whether to run calls to Pandas Checks .check.assert_data() globally. + |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ Series
+ |
+
+
+
+ The original Series, unchanged. + |
+
shape(fn=lambda s: s, check_name='📐 Shape')
+
+Displays the Series's dimensions, without modifying the Series itself.
+See Pandas docs for shape
for additional usage information.
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
fn |
+
+ Callable
+ |
+
+
+
+ An optional lambda function to apply to the Series before running Pandas |
+
+ lambda s: s
+ |
+
check_name |
+
+ Union[str, None]
+ |
+
+
+
+ An optional name for the check, to be printed as preface to the result. + |
+
+ '📐 Shape'
+ |
+
Returns:
+Type | +Description | +
---|---|
+ Series
+ |
+
+
+
+ The original Series, unchanged. + |
+
See also .check.nrows()
+tail(n=5, fn=lambda s: s, check_name=None)
+
+Displays the last n rows of the Series, without modifying the Series itself.
+See Pandas docs for tail() for additional usage information.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
n |
+
+ int
+ |
+
+
+
+ Number of rows to show. + |
+
+ 5
+ |
+
fn |
+
+ Callable
+ |
+
+
+
+ An optional lambda function to apply to the Series before running Pandas tail(). Example: |
+
+ lambda s: s
+ |
+
check_name |
+
+ Union[str, None]
+ |
+
+
+
+ An optional name for the check, to be printed as preface to the result. + |
+
+ None
+ |
+
Returns:
+Type | +Description | +
---|---|
+ Series
+ |
+
+
+
+ The original Series, unchanged. + |
+
unique(fn=lambda s: s, check_name=None)
+
+Displays the unique values in a Series, without modifying the Series itself.
+See Pandas docs for unique() for additional usage information.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
fn |
+
+ Callable
+ |
+
+
+
+ An optional lambda function to apply to the Series before running Pandas unique(). Example: |
+
+ lambda s: s
+ |
+
check_name |
+
+ Union[str, None]
+ |
+
+
+
+ An optional name for the check, to be printed as preface to the result. + |
+
+ None
+ |
+
Returns:
+Type | +Description | +
---|---|
+ Series
+ |
+
+
+
+ The original Series, unchanged. + |
+
value_counts(fn=lambda s: s, max_rows=10, check_name=None, **kwargs)
+
+Displays the value counts for a Series, without modifying the Series itself.
+See Pandas docs for value_counts() for additional usage information, including more configuration options you can pass to this Pandas Checks method.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
max_rows |
+
+ int
+ |
+
+
+
+ Maximum number of rows to show in the value counts. + |
+
+ 10
+ |
+
fn |
+
+ Callable
+ |
+
+
+
+ An optional lambda function to apply to the Series before running Pandas value_counts(). Example: |
+
+ lambda s: s
+ |
+
check_name |
+
+ Union[str, None]
+ |
+
+
+
+ An optional name for the check, to be printed as preface to the result. + |
+
+ None
+ |
+
**kwargs |
+
+ Any
+ |
+
+
+
+ Optional, additional arguments that are accepted by Pandas value_counts() method. + |
+
+ {}
+ |
+
Returns:
+Type | +Description | +
---|---|
+ Series
+ |
+
+
+
+ The original Series, unchanged. + |
+
write(path, format=None, fn=lambda s: s, verbose=False, **kwargs)
+
+Exports Series to file, without modifying the Series itself.
+Format is inferred from path extension like .csv.
+This functions uses the corresponding Pandas export function such as to_csv(). See Pandas docs for those functions for additional usage information, including more configuration options you can pass to this Pandas Checks method.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
path |
+
+ str
+ |
+
+
+
+ Path to write the file to. + |
+ + required + | +
format |
+
+ Union[str, None]
+ |
+
+
+
+ Optional file format to force for the export. If None, format is inferred from the file's extension in |
+
+ None
+ |
+
fn |
+
+ Callable
+ |
+
+
+
+ An optional lambda function to apply to the Series before exporting. Example: |
+
+ lambda s: s
+ |
+
verbose |
+
+ bool
+ |
+
+
+
+ Whether to print a message when the file is written. + |
+
+ False
+ |
+
**kwargs |
+
+ Any
+ |
+
+
+
+ Optional, additional keyword arguments to pass to the Pandas export function (.to_csv). + |
+
+ {}
+ |
+
Returns:
+Type | +Description | +
---|---|
+ Series
+ |
+
+
+
+ The original Series, unchanged. + |
+
Exporting to some formats such as Excel, Feather, and Parquet may require you to install additional packages.
+Utilities for displaying text, tables, and plots in Pandas Checks in both terminal and IPython/Jupyter environments.
+ + + +_display_check(data, name=None)
+
+Renders the result of a Pandas Checks method.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
data |
+
+ Any
+ |
+
+
+
+ The data to display. + |
+ + required + | +
name |
+
+ Union[str, None]
+ |
+
+
+
+ The optional name of the check. + |
+
+ None
+ |
+
Returns:
+Type | +Description | +
---|---|
+ None
+ |
+
+
+
+ None + |
+
_display_line(line, lead_in=None, colors={})
+
+Displays a line of text with optional formatting.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
line |
+
+ str
+ |
+
+
+
+ The text to display. + |
+ + required + | +
lead_in |
+
+ Union[str, None]
+ |
+
+
+
+ The optional text to display before the main text. + |
+
+ None
+ |
+
colors |
+
+ Dict
+ |
+
+
+
+ An optional dictionary containing color options for the text and lead-in text. See syntax in docstring for _render_text(). + |
+
+ {}
+ |
+
Returns:
+Type | +Description | +
---|---|
+ None
+ |
+
+
+
+ None + |
+
_display_plot()
+
+Renders the active Pandas Checks matplotlib plot object in an IPython/Jupyter environment with an optional indent.
+ + +Returns:
+Type | +Description | +
---|---|
+ None
+ |
+
+
+
+ None + |
+
It assumes the plot has already been drawn by another function, such as with .plot() or .hist().
+_display_plot_title(line, lead_in=None, colors={})
+
+Displays a plot title with optional formatting.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
line |
+
+ str
+ |
+
+
+
+ The title text to display. + |
+ + required + | +
lead_in |
+
+ Union[str, None]
+ |
+
+
+
+ Optional text to display before the title. + |
+
+ None
+ |
+
colors |
+
+ Dict
+ |
+
+
+
+ An optional dictionary containing color settings for the text and lead-in text. See details in docstring for _render_text(). + |
+
+ {}
+ |
+
Returns:
+Type | +Description | +
---|---|
+ None
+ |
+
+
+
+ None + |
+
_display_table(table)
+
+Renders a Pandas DataFrame or Series in an IPython/Jupyter environment with an optional indent.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
table |
+
+ Union[DataFrame, Series]
+ |
+
+
+
+ The DataFrame or Series to display. + |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ None
+ |
+
+
+
+ None + |
+
_display_table_title(line, lead_in=None, colors={})
+
+Displays a table title with optional formatting.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
line |
+
+ str
+ |
+
+
+
+ The title text to display. + |
+ + required + | +
lead_in |
+
+ Union[str, None]
+ |
+
+
+
+ Optional text to display before the title. + |
+
+ None
+ |
+
colors |
+
+ Dict
+ |
+
+
+
+ An optiona dictionary containing color options for the text and lead-in text. See details in docstring for _render_text() + |
+
+ {}
+ |
+
Returns:
+Type | +Description | +
---|---|
+ None
+ |
+
+
+
+ None + |
+
_filter_emojis(text)
+
+Removes emojis from text if user has globally forbidden them.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
text |
+
+ str
+ |
+
+
+
+ The text to filter emojis from. + |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ str
+ |
+
+
+
+ The text with emojis removed if the user's global settings do not allow emojis. Else, the original text. + |
+
_format_background_color(color)
+
+Applies a background color to text used being displayed in the terminal.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
color |
+
+ str
+ |
+
+
+
+ The background color to format. See syntax in docstring for _render_text(). + |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ str
+ |
+
+
+
+ The formatted background color. + |
+
_lead_in(lead_in, foreground, background)
+
+Formats a lead-in text with colors.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
lead_in |
+
+ Union[str, None]
+ |
+
+
+
+ The lead-in text to format. + |
+ + required + | +
foreground |
+
+ str
+ |
+
+
+
+ The foreground color for the lead-in text. See syntax in docstring for _render_text(). + |
+ + required + | +
background |
+
+ str
+ |
+
+
+
+ The background color for the lead-in text. See syntax in docstring for _render_text(). + |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ str
+ |
+
+
+
+ The formatted lead-in text. + |
+
_print_table_terminal(table)
+
+Prints a Pandas table in a terminal with an optional indent.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
table |
+
+ Union[DataFrame, Series]
+ |
+
+
+
+ A DataFrame or Series. + |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ None
+ |
+
+
+
+ None + |
+
_render_html_with_indent(object_as_html)
+
+Renders HTML with an optional indent.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
object_as_html |
+
+ str
+ |
+
+
+
+ The HTML to render. + |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ None
+ |
+
+
+
+ None + |
+
_render_text(text, tag, lead_in=None, colors={})
+
+Renders text with optional formatting.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
text |
+
+ str
+ |
+
+
+
+ The text to render. + |
+ + required + | +
tag |
+
+ str
+ |
+
+
+
+ The HTML tag to use for rendering. + |
+ + required + | +
lead_in |
+
+ Union[str, None]
+ |
+
+
+
+ Optional text to display before the main text. + |
+
+ None
+ |
+
colors |
+
+ Dict
+ |
+
+
+
+ Optional colors for the text and lead-in text.
+Keys include:
+ - text_color: The foreground color of the main text.
+ - text_background_color: The background or highlight color of the main text.
+ - lead_in_text_color: The foreground color of lead-in text.
+ - lead_in_background_color: The background color of lead-in text.
+Color values are phrased such as "blue" or "white". They are passed to either HTML
+ for Jupyter/IPython outputs and to |
+
+ {}
+ |
+
Returns:
+Type | +Description | +
---|---|
+ None
+ |
+
+
+
+ None + |
+
_warning(message, lead_in='🐼🩺 Pandas Checks warning', clean_type=False)
+
+Displays a warning message.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
message |
+
+ str
+ |
+
+
+
+ The warning message to display. + |
+ + required + | +
lead_in |
+
+ str
+ |
+
+
+
+ Optional lead-in text to display before the warning message. + |
+
+ '🐼🩺 Pandas Checks warning'
+ |
+
clean_type |
+
+ bool
+ |
+
+
+
+ Optional flag to remove the class type from the message, when running .check.dtype(). + |
+
+ False
+ |
+
Returns:
+Type | +Description | +
---|---|
+ None
+ |
+
+
+
+ None + |
+
Utilities for configuring Pandas Checks options.
+This module provides functions for setting and managing global options for +Pandas Checks, including formatting and disabling checks and assertions.
+ + + +_initialize_format_options(options=None)
+
+Initializes or resets Pandas Checks formatting options.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
options |
+
+ Union[List[str], None]
+ |
+
+
+
+ A list of option names to initialize or reset. +If None, all formatting options will be initialized or reset. + |
+
+ None
+ |
+
Returns: + None
+ + +We separate this function from _initialize_options() so user can reset just formatting without changing mode
+_initialize_options()
+
+Initializes (or resets) all Pandas Checks options to their default values.
+ + +Returns:
+Type | +Description | +
---|---|
+ None
+ |
+
+
+
+ None + |
+
We separate this function from _initialize_format_options() so user can reset just formatting if desired without changing mode
+_register_option(name, default_value, description, validator)
+
+Registers a Pandas Checks option in the global Pandas context manager.
+If the option has already been registered, reset its value.
+This method enables setting global formatting for Pandas Checks results and storing +variables that will persist across Pandas method chains, which return newly +initialized DataFrames at each method (and so reset the DataFrame's attributes).
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
name |
+
+ str
+ |
+
+
+
+ The name of the option to register. + |
+ + required + | +
default_value |
+
+ Any
+ |
+
+
+
+ The default value for the option. + |
+ + required + | +
description |
+
+ str
+ |
+
+
+
+ A description of the option. + |
+ + required + | +
validator |
+
+ Callable
+ |
+
+
+
+ A function to validate the option value. + |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ None
+ |
+
+
+
+ None + |
+
For more details on the arguments, see the documentation for +pandas._config.config.register_option()
+_set_option(option, value)
+
+Updates the value of a Pandas Checks option in the global Pandas context manager.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
option |
+
+ str
+ |
+
+
+
+ The name of the option to set. + |
+ + required + | +
value |
+
+ Any
+ |
+
+
+
+ The value to set for the option. + |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ None
+ |
+
+
+
+ None + |
+
Raises:
+Type | +Description | +
---|---|
+ AttributeError
+ |
+
+
+
+ If the |
+
describe_options()
+
+Prints all global options for Pandas Checks, their default values, and current values.
+ + +Returns:
+Type | +Description | +
---|---|
+ None
+ |
+
+
+
+ None + |
+
disable_checks(enable_asserts=True)
+
+Turns off all calls to Pandas Checks methods and optionally enables or disables check.assert_data(). Does not modify the DataFrame itself.
+If this function is called, subequent calls to .check functions will not be run.
+Typically used to + 1) Globally switch off Pandas Checks, such as during production. or + 2) Temporarily switch off Pandas Checks, such as for a stable part of a notebook.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
enable_asserts |
+
+ bool
+ |
+
+
+
+ Whether to also run calls to Pandas Checks .check.assert_data() + |
+
+ True
+ |
+
Returns:
+Type | +Description | +
---|---|
+ None
+ |
+
+
+
+ None + |
+
enable_checks(enable_asserts=True)
+
+Turns on Pandas Checks globally. Subsequent calls to .check methods will be run.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
enable_asserts |
+
+ bool
+ |
+
+
+
+ Whether to also enable or disable check.assert_data(). + |
+
+ True
+ |
+
Returns:
+Type | +Description | +
---|---|
+ None
+ |
+
+
+
+ None + |
+
get_mode()
+
+Returns whether Pandas Checks is currently running checks and assertions.
+ + +Returns:
+Type | +Description | +
---|---|
+ Dict[str, bool]
+ |
+
+
+
+ A dictionary containing the current settings. + |
+
reset_format()
+
+Globally restores all Pandas Checks formatting options to their default "factory" settings.
+ + +Returns:
+Type | +Description | +
---|---|
+ None
+ |
+
+
+
+ None + |
+
set_format(**kwargs)
+
+Configures selected formatting options for Pandas Checks. Run pandas_checks.describe_options() to see a list of available options.
+For example, set_format(check_text_tag= "h1", use_emojis=False`) +will globally change Pandas Checks to display text results as H1 headings and remove all emojis.
+ + +Returns:
+Type | +Description | +
---|---|
+ None
+ |
+
+
+
+ None + |
+
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
**kwargs |
+
+ Any
+ |
+
+
+
+ Pairs of setting name and its new value. + |
+
+ {}
+ |
+
set_mode(enable_checks, enable_asserts)
+
+Configures the operation mode for Pandas Checks globally.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
enable_checks |
+
+ bool
+ |
+
+
+
+ Whether to run any Pandas Checks methods globally. Does not affect .check.assert_data(). + |
+ + required + | +
enable_asserts |
+
+ bool
+ |
+
+
+
+ Whether to run calls to .check.assert_data() globally. + |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ None
+ |
+
+
+
+ None + |
+
Utilities for running Pandas Checks data checks.
+ + + +_apply_modifications(data, fn=lambda df: df, subset=None)
+
+Applies user's modifications to a data object.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
data |
+
+ Any
+ |
+
+
+
+ May be any Pandas DataFrame, Series, string, or other variable + |
+ + required + | +
fn |
+
+ Callable
+ |
+
+
+
+ An optional lambda function to modify |
+
+ lambda df: df
+ |
+
subset |
+
+ Union[str, List, None]
+ |
+
+
+
+ Columns to subset after applying modifications + |
+
+ None
+ |
+
Returns:
+Type | +Description | +
---|---|
+ Any
+ |
+
+
+
+ Modified and optionally subsetted data object. If all arguments are defaults, data is returned unchanged. + |
+
_check_data(data, check_fn=lambda df: df, modify_fn=lambda df: df, subset=None, check_name=None)
+
+Runs a selected check on a data object
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
data |
+
+ Any
+ |
+
+
+
+ A Pandas DataFrame, Series, string, or other variable + |
+ + required + | +
check_fn |
+
+ Callable
+ |
+
+
+
+ Function to apply to data for checking. For example if we're running .check.value_counts(), this function would appply the Pandas value_counts() method + |
+
+ lambda df: df
+ |
+
modify_fn |
+
+ Callable
+ |
+
+
+
+ Optional function to modify data before checking + |
+
+ lambda df: df
+ |
+
subset |
+
+ Union[str, List, None]
+ |
+
+
+
+ Optional list of columns or name of column to subset data before running check_fn + |
+
+ None
+ |
+
check_name |
+
+ Union[str, None]
+ |
+
+
+
+ Name to use when displaying check result + |
+
+ None
+ |
+
Returns:
+Type | +Description | +
---|---|
+ None
+ |
+
+
+
+ None + |
+
_display_check(data, name=None)
+
+Renders the result of a Pandas Checks method.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
data |
+
+ Any
+ |
+
+
+
+ The data to display. + |
+ + required + | +
name |
+
+ Union[str, None]
+ |
+
+
+
+ The optional name of the check. + |
+
+ None
+ |
+
Returns:
+Type | +Description | +
---|---|
+ None
+ |
+
+
+
+ None + |
+
get_mode()
+
+Returns whether Pandas Checks is currently running checks and assertions.
+ + +Returns:
+Type | +Description | +
---|---|
+ Dict[str, bool]
+ |
+
+
+
+ A dictionary containing the current settings. + |
+
Provides a timer utility for tracking the elapsed time of steps within a Pandas method chain.
+Note that these functions rely on the pdchecks.enable_checks
option being enabled in the Pandas configuration, as it is by default.
_display_line(line, lead_in=None, colors={})
+
+Displays a line of text with optional formatting.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
line |
+
+ str
+ |
+
+
+
+ The text to display. + |
+ + required + | +
lead_in |
+
+ Union[str, None]
+ |
+
+
+
+ The optional text to display before the main text. + |
+
+ None
+ |
+
colors |
+
+ Dict
+ |
+
+
+
+ An optional dictionary containing color options for the text and lead-in text. See syntax in docstring for _render_text(). + |
+
+ {}
+ |
+
Returns:
+Type | +Description | +
---|---|
+ None
+ |
+
+
+
+ None + |
+
get_mode()
+
+Returns whether Pandas Checks is currently running checks and assertions.
+ + +Returns:
+Type | +Description | +
---|---|
+ Dict[str, bool]
+ |
+
+
+
+ A dictionary containing the current settings. + |
+
print_time_elapsed(start_time, lead_in='⏱️ Time elapsed', units='auto')
+
+Displays the time elapsed since start_time.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
start_time |
+
+ float
+ |
+
+
+
+ The index time when the stopwatch started, which comes from the Pandas Checks start_timer() + |
+ + required + | +
lead_in |
+
+ Union[str, None]
+ |
+
+
+
+ Optional text to print before the elapsed time. + |
+
+ '⏱️ Time elapsed'
+ |
+
units |
+
+ str
+ |
+
+
+
+ The units in which to display the elapsed time. Accepted values: +- "auto" +- "milliseconds", "seconds", "minutes", "hours" +- "ms", "s", "m", "h" + |
+
+ 'auto'
+ |
+
Returns:
+Type | +Description | +
---|---|
+ None
+ |
+
+
+
+ None + |
+
Raises:
+Type | +Description | +
---|---|
+ ValueError
+ |
+
+
+
+ If |
+
If you change the default values for this function's argument,
+change them in .check.print_time_elapsed
too in DataFrameChecks and SeriesChecks
+so they're exposed to the user.
start_timer(verbose=False)
+
+Starts a Pandas Checks stopwatch to measure run time between operations, such as steps in a Pandas method chain. Use print_elapsed_time() to get timings.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
verbose |
+
+ bool
+ |
+
+
+
+ Whether to print a message that the timer has started. + |
+
+ False
+ |
+
Returns:
+Type | +Description | +
---|---|
+ float
+ |
+
+
+
+ Timestamp as a float + |
+
Utility functions for the pandas_checks package.
+ + + +_display_line(line, lead_in=None, colors={})
+
+Displays a line of text with optional formatting.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
line |
+
+ str
+ |
+
+
+
+ The text to display. + |
+ + required + | +
lead_in |
+
+ Union[str, None]
+ |
+
+
+
+ The optional text to display before the main text. + |
+
+ None
+ |
+
colors |
+
+ Dict
+ |
+
+
+
+ An optional dictionary containing color options for the text and lead-in text. See syntax in docstring for _render_text(). + |
+
+ {}
+ |
+
Returns:
+Type | +Description | +
---|---|
+ None
+ |
+
+
+
+ None + |
+
_has_nulls(data, fail_message, raise_exception=True, exception_to_raise=DataError)
+
+Utility function to check for nulls as part of a larger check
+ +_is_type(data, dtype)
+
+Utility function to check if a dataframe's columns or one series has an expected type. +Includes special handling for strings, since 'object' type in Pandas +may not mean a string
+ +_lambda_to_string(lambda_func)
+
+Create a string representation of a lambda function.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
lambda_func |
+
+ Callable
+ |
+
+
+
+ An arbitrary function in lambda form + |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ str
+ |
+
+
+
+ A string version of lambda_func + |
+
This still returns all arguments to the calling function. + They get entangled with the argument when it's a lambda function. + Try other ways to get just the argument we want.
+_series_is_type(s, dtype)
+
+Utility function to check if a series has an expected type. +Includes special handling for strings, since 'object' type in Pandas +may not mean a string
+ +