Skip to content

Commit

Permalink
implement ignore_na in Check objects (#215)
Browse files Browse the repository at this point in the history
* implement ignore_na in Check objects

* handle null check column and groupby columns

* add check null value handling in docs
  • Loading branch information
cosmicBboy committed Jun 4, 2020
1 parent 0b0d6cc commit 180072e
Show file tree
Hide file tree
Showing 5 changed files with 198 additions and 129 deletions.
16 changes: 15 additions & 1 deletion docs/source/checks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,20 @@ checks.

.. _grouping:

Handling Null Values
--------------------

By default, ``pandera`` drops null values before passing the objects to
validate into the check function. For ``Series`` objects null elements are
dropped (this also applies to columns), and for ``DataFrame`` objects, rows
with any null value are dropped.

If you want to check the properties of a pandas data structure while preserving
null values, specify ``Check(..., ignore_na=False)`` when defining a check.

Note that this is different from the ``nullable`` argument in :py:class:`Column`
objects, which simply checks for null values in a column.

Column Check Groups
-------------------

Expand All @@ -106,7 +120,7 @@ Specifying ``groupby`` as a column name, list of column names, or
callable changes the expected signature of the :py:class:`Check`
function argument to:

``Dict[Any, pd.Series] -> Union[bool, pd.Series]``
``Callable[Dict[Any, pd.Series] -> Union[bool, pd.Series]``

where the dict keys are the discrete keys in the ``groupby`` columns.

Expand Down

0 comments on commit 180072e

Please sign in to comment.