-
-
Notifications
You must be signed in to change notification settings - Fork 321
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement minimal built-in checks for Ibis backend (#1885)
* Implement minimal built-in checks for Ibis backend Signed-off-by: Deepyaman Datta <[email protected]> * Implement `Column` validation for the Ibis backend Signed-off-by: Deepyaman Datta <[email protected]> * Promote check object to table during preprocessing Signed-off-by: Deepyaman Datta <[email protected]> * Remove extraneous fixture for backend registration Signed-off-by: Deepyaman Datta <[email protected]> * Resolve lint (unused imports, undefined variables) Signed-off-by: Deepyaman Datta <[email protected]> * Partially standardize docstrings of builtin checks Signed-off-by: Deepyaman Datta <[email protected]> * Fix the `preprocess` docstrings copied from pandas Signed-off-by: Deepyaman Datta <[email protected]> * Format pandera/backends/ibis/checks.py using Black Signed-off-by: Deepyaman Datta <[email protected]> --------- Signed-off-by: Deepyaman Datta <[email protected]>
- Loading branch information
Showing
10 changed files
with
259 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
"""Built-in checks for Ibis.""" | ||
|
||
from typing import Any, TypeVar | ||
|
||
import ibis.expr.types as ir | ||
|
||
from pandera.api.extensions import register_builtin_check | ||
from pandera.api.ibis.types import IbisData | ||
|
||
T = TypeVar("T") | ||
|
||
|
||
@register_builtin_check( | ||
aliases=["eq"], | ||
error="equal_to({value})", | ||
) | ||
def equal_to(data: IbisData, value: Any) -> ir.Table: | ||
"""Ensure all elements of a data container equal a certain value. | ||
:param data: NamedTuple IbisData contains the table and column name for the check. The key | ||
to access the table is "table", and the key to access the column name is "key". | ||
:param value: Values in this Ibis data structure must be | ||
equal to this value. | ||
""" | ||
return data.table[data.key] == value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.