和顺 / 衡律 返回所属 Agent
3.6

质量检查与数据发布

原能力

实施完整性、一致性和异常检查,合格数据方可发布,失败和未知分别保存。(合同附件 R7 3.6)

首选项目

Pandera(MIT)。 Pandera

匹配范围

DataFrameSchema 和具名复核流程。

源码

Pandera · class Check(

pandera/api/checks.py · 18–31 行。 在 GitHub 查看源码 · 许可证与声明

源码片段
class Check(BaseCheck):
    """Check a data object for certain properties."""

    def __init__(
        self,
        check_fn: Callable,
        groups: Union[str, list[Hashable]] | None = None,
        groupby: Union[str, list[str], Callable] | None = None,
        ignore_na: bool = True,
        element_wise: bool = False,
        native: bool = True,
        name: str | None = None,
        error: str | None = None,
        raise_warning: bool = False,

Pandera · def validate(

pandera/api/pandas/container.py · 127–140 行。 在 GitHub 查看源码 · 许可证与声明

源码片段
    def validate(
        self,
        check_obj: pd.DataFrame,
        head: int | None = None,
        tail: int | None = None,
        sample: int | None = None,
        random_state: int | None = None,
        lazy: bool = False,
        inplace: bool = False,
    ) -> pd.DataFrame:
        """Validate a DataFrame based on the schema specification.

        :param pd.DataFrame check_obj: the dataframe to be validated.
        :param head: validate the first n rows. Rows overlapping with `tail` or

实现与验收要点

完整性/冲突标准、批准发布及失败未知分离。