Skip to content
Back to search

pointblank

Data validation toolkit for assessing and monitoring data quality.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today

Check it deeper on your machine

It has changed since its scan on 11 Nov 2026.

As a Claude Code plugin, install it and then ask Claude Code:

/plugin marketplace add keithmackay/mackayi/plugin install scanskillsafety@mackayiDo a deep scan of https://github.com/posit-dev/pointblank with scanskillsafety

Or from a terminal, clone it and run it:

git clone https://github.com/keithmackay/scanskillsafety-skill ~/.claude/skills/scanskillsafetynode ~/.claude/skills/scanskillsafety/cli.cjs --deep 'https://github.com/posit-dev/pointblank'

It checks the exact commit: every file, its packages against OSV (api.osv.dev), how it compares with this page's scan (findsafeskills.com receives the repository's address), and, if you agree, Claude reading every file with your own Claude subscription. It never runs the code.

Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/posit-dev--pointblank/badge.svg)](/listings/posit-dev--pointblank)

HTML

<a href="/listings/posit-dev--pointblank"><img src="/api/listings/posit-dev--pointblank/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

The `DraftValidation` class uses LLMs to analyze your data and generate a complete validation plan with intelligent suggestions. This helps you quickly get started with data validation or jumpstart a new project.

import pointblank as pb

# Load your data
data = pb.load_dataset("game_revenue")              # A sample dataset

# Use DraftValidation to generate a validation plan
pb.DraftValidation(data=data, model="anthropic:claude-opus-4-6")

The output is a complete validation plan with intelligent suggestions based on your data:

import pointblank as pb

# The validation plan
validation = (
    pb.Validate(
        data=data,
        label="Draft Validation",
        thresholds=pb.Thresholds(warning=0.10, error=0.25, critical=0.35)
    )
    .col_vals_in_set(columns="item_type", set=["iap", "ad"])
    .col_vals_gt(columns="item_revenue", value=0)
    .col_vals_between(columns="session_duration", left=3.2, right=41.0)
    .col_count_match(count=11)
    .row_count_match(count=2000)
    .rows_distinct()
    .interrogate()
)

validation

<div align="center"> </div>

<br>

Copy, paste, and customize the generated validation plan for your needs.

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 608 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.

  1. > [!TIP]
  2. > **📖 [Pointblank: The Complete Guide](https://rich-iannone.github.io/pointblank-the-complete-guide/)**: A comprehensive (and free!) book on data validation with Pointblank is now being written. Follow along and learn everything from first steps to advanced validation patterns and AI-assisted workflows.
  3. <details>
  4. <summary>📊 Book chapter progress</summary>
  5. <br>
  6. <!-- BOOK_PROGRESS_BEGIN -->
  7. Overall: **31%** complete &mdash; 14 of 37 chapters have content
  8. **Foundations**<br>
  9. Intro: `███████████████` 100%<br>
  10. Getting Started: `█████████████░░` 88%<br>
  11. Inspecting Data: `███████████████` 100%<br>
  12. Validation Workflow: `███████████████` 100%<br>
  13. Analysis Loop: `██████████░░░░░` 65%<br>
  14. **Building Validation Plans**<br>
  15. Column Validations: `███████████████` 100%<br>
  16. Aggregate Validations: `███████████░░░░` 71%<br>
  17. Row Validations: `███████████░░░░` 72%<br>
  18. Table Validations: `███████████████` 100%<br>
  19. Missing Data: `███████████████` 100%<br>
  20. Segmented Validation: `███████████░░░░` 75%<br>
  21. Advanced Validation: `████████████░░░` 78%<br>
  22. **Responding to Results**<br>
  23. Thresholds & Actions: `███████████████` 100%<br>
  24. Reports & Extracts: `█░░░░░░░░░░░░░░` 9%<br>
  25. Quality Scoring: `░░░░░░░░░░░░░░░` 0%<br>
  26. Notifications & Observability: `░░░░░░░░░░░░░░░` 0%<br>
  27. **AI-Assisted Validation**<br>
  28. Semantic Validation: `░░░░░░░░░░░░░░░` 1%<br>
  29. AI Authoring: `░░░░░░░░░░░░░░░` 1%<br>
  30. **Data Sources, Interfaces & Automation**<br>
  31. Data Sources: `░░░░░░░░░░░░░░░` 1%<br>
  32. YAML Workflows: `░░░░░░░░░░░░░░░` 1%<br>
  33. Command Line: `░░░░░░░░░░░░░░░` 1%<br>
  34. MCP Server: `░░░░░░░░░░░░░░░` 1%<br>
  35. **Data Contracts & Pipelines**<br>
  36. Data Contracts: `░░░░░░░░░░░░░░░` 1%<br>
  37. Pipelines: `░░░░░░░░░░░░░░░` 1%<br>
  38. **Test Data Generation**<br>
  39. Test Data Generation: `░░░░░░░░░░░░░░░` 1%<br>
  40. **Clinical & Regulated Data**<br>
  41. Clinical & CDISC: `░░░░░░░░░░░░░░░` 0%<br>
  42. CDISC Conformance: `░░░░░░░░░░░░░░░` 0%<br>
  43. **Industry Playbooks**<br>
  44. Financial: `░░░░░░░░░░░░░░░` 0%<br>
  45. Ecommerce: `░░░░░░░░░░░░░░░` 0%<br>
  46. Data Engineering: `░░░░░░░░░░░░░░░` 0%<br>
  47. Healthcare: `░░░░░░░░░░░░░░░` 0%<br>
  48. Real-World Evidence: `░░░░░░░░░░░░░░░` 0%<br>
  49. ML Monitoring: `░░░░░░░░░░░░░░░` 0%<br>
  50. IoT Sensors: `░░░░░░░░░░░░░░░` 0%<br>
  51. Insurance: `░░░░░░░░░░░░░░░` 0%<br>
  52. Public Sector: `░░░░░░░░░░░░░░░` 0%<br>
  53. Marketing: `░░░░░░░░░░░░░░░` 0%<br>
  54. <!-- BOOK_PROGRESS_END -->
  55. </details>
  56. <div align="center">
  57. <a href="https://posit-dev.github.io/pointblank/"><img src="https://posit-dev.github.io/pointblank/assets/pointblank_logo.svg" width="85%"/></a>
  58. _Data validation toolkit for assessing and monitoring data quality._
  59. [![Python Versions](https://img.shields.io/pypi/pyversions/pointblank.svg)](https://pypi.python.org/pypi/pointblank)
  60. [![PyPI](https://img.shields.io/pypi/v/pointblank)](https://pypi.org/project/pointblank/#history)
  61. [![PyPI Downloads](https://img.shields.io/pypi/dm/pointblank)](https://pypistats.org/packages/pointblank)
  62. [![Conda Version](https://img.shields.io/conda/vn/conda-forge/pointblank.svg)](https://anaconda.org/conda-forge/pointblank)
  63. [![License](https://img.shields.io/github/license/posit-dev/pointblank)](https://img.shields.io/github/license/posit-dev/pointblank)
  64. [![CI Build](https://github.com/posit-dev/pointblank/actions/workflows/ci-tests.yaml/badge.svg)](https://github.com/posit-dev/pointblank/actions/workflows/ci-tests.yaml)
  65. [![Codecov branch](https://img.shields.io/codecov/c/github/posit-dev/pointblank/main.svg)](https://codecov.io/gh/posit-dev/pointblank)
  66. [![Repo Status](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
  67. [![Documentation](https://img.shields.io/badge/docs-project_website-blue.svg)](https://posit-dev.github.io/pointblank/)
  68. [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/posit-dev/pointblank)
  69. [![Contributors](https://img.shields.io/github/contributors/posit-dev/pointblank)](https://github.com/posit-dev/pointblank/graphs/contributors)
  70. [![Discord](https://img.shields.io/discord/1345877328982446110?color=%237289da&label=Discord)](https://discord.com/invite/YH7CybCNCQ)
  71. [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.1%20adopted-ff69b4.svg)](https://www.contributor-covenant.org/version/2/1/code_of_conduct.html)
  72. </div>
  73. <div align="center">
  74. <a href="translations/README.fr.md">Français</a> |
  75. <a href="translations/README.de.md">Deutsch</a> |
  76. <a href="translations/README.it.md">Italiano</a> |
  77. <a href="translations/README.es.md">Español</a> |
  78. <a href="translations/README.pt-BR.md">Português</a> |
  79. <a href="translations/README.nl.md">Nederlands</a> |
  80. <a href="translations/README.zh-CN.md">简体中文</a> |
  81. <a href="translations/README.ja.md">日本語</a> |
  82. <a href="translations/README.ko.md">한국어</a> |
  83. <a href="translations/README.hi.md">हिन्दी</a> |
  84. <a href="translations/README.ar.md">العربية</a>
  85. </div>
  86. <br>
  87. Pointblank is a data validation library for Python. You describe what your data should look like in a validation plan, Pointblank checks the data against it, and the results come back as a report that's easy to read and to share. Data quality then becomes something the whole team can discuss, not just a list of errors in a log.
  88. The same plan works on Polars and Pandas DataFrames, on database tables (DuckDB, PostgreSQL, Snowflake, BigQuery, and others), and on PySpark. After a validation, you can look at the failing rows, split the table into the rows that pass and the rows that fail, or act when too many rows fail.
  89. ## Getting Started
  90. Every validation follows the same pattern: (1) start with `Validate`, (2) add validation steps, and (3) finish with `interrogate()`.
  91. ```python
  92. import pointblank as pb
  93. validation = (
  94. pb.Validate(data=pb.load_dataset(dataset="small_table"))
  95. .col_vals_gt(columns="d", value=100) # Validate values > 100
  96. .col_vals_le(columns="c", value=5) # Validate values <= 5
  97. .col_exists(columns=["date", "date_time"]) # Check columns exist
  98. .interrogate() # Execute and collect results
  99. )
  100. # Get the validation report from the REPL with:
  101. validation.get_tabular_report().show()
  102. # From a notebook simply use:
  103. validation
  104. ```
  105. <div align="center">
  106. <img src="https://posit-dev.github.io/pointblank/assets/pointblank-tabular-report.png" width="800px">
  107. </div>
  108. <br>
  109. Once you have an interrogated `validation` object, you can:
  110. - get a [report for a single step](https://posit-dev.github.io/pointblank/user-guide/post-interrogation/step-reports.html) that shows the failing rows
  111. - [extract the failing rows](https://posit-dev.github.io/pointblank/user-guide/post-interrogation/extracts.html) for debugging
  112. - [split the table](https://posit-dev.github.io/pointblank/user-guide/post-interrogation/sundering.html) into the rows that pass and the rows that fail
  113. ## Installation
  114. You can install Pointblank using pip:
  115. ```bash
  116. pip install pointblank
  117. ```
  118. You can also install Pointblank from Conda-Forge by using:
  119. ```bash
  120. conda install conda-forge::pointblank
  121. ```
  122. If you don't have Polars or Pandas installed, you'll need to install one of them to use Pointblank.
  123. ```bash
  124. pip install "pointblank[pl]" # Install Pointblank with Polars
  125. pip install "pointblank[pd]" # Install Pointblank with Pandas
  126. ```
  127. To validate tables in a database, install Pointblank with the Ibis backend for it (or with PySpark, for Spark DataFrames):
  128. ```bash
  129. pip install "pointblank[duckdb]" # DuckDB
  130. pip install "pointblank[postgres]" # PostgreSQL
  131. pip install "pointblank[mysql]" # MySQL
  132. pip install "pointblank[sqlite]" # SQLite
  133. pip install "pointblank[mssql]" # SQL Server
  134. pip install "pointblank[snowflake]" # Snowflake
  135. pip install "pointblank[bigquery]" # BigQuery
  136. pip install "pointblank[databricks]" # Databricks
  137. pip install "pointblank[pyspark]" # PySpark
  138. ```
  139. Other extras add optional features, such as `generate` (for drafting plans with an LLM), `mcp` (the MCP server), and `otel` (OpenTelemetry). See the [installation guide](https://posit-dev.github.io/pointblank/user-guide/getting-started/installation.html) for more.
  140. ## Why Pointblank?
  141. - **Works with your existing stack**: one API for Polars, Pandas, PySpark, DuckDB, PostgreSQL, MySQL, SQLite, SQL Server, Snowflake, BigQuery, Databricks, and files like CSV and Parquet
  142. - **Reports to share**: validation reports that show what was checked and what failed, for colleagues who don't read code, in 40 languages
  143. - **Thresholds and actions**: set 'warning', 'error', and 'critical' levels for each step, and run actions (like a Slack message) when they're exceeded
  144. - **Results you can use**: counts, failing rows, the table split by the results, or a full report
  145. - **Runs anywhere**: in notebooks, scripts, CI pipelines, scheduled jobs, or from the command line
  146. ## A Validation for Production
  147. A validation in a production pipeline usually needs more: a name for the table, thresholds, actions when the thresholds are exceeded, and briefs that say what each step checks.
  148. ```python
  149. import pointblank as pb
  150. import polars as pl
  151. # Load your data
  152. sales_data = pl.read_csv("sales_data.csv")
  153. validation = (
  154. pb.Validate(
  155. data=sales_data,
  156. tbl_name="sales_data", # Name of the table for reporting
  157. label="Real-world example.", # Label for the validation, appears in reports
  158. thresholds=(0.01, 0.02, 0.05), # Thresholds for warnings, errors, and critical issues
  159. actions=pb.Actions( # An action for any step that exceeds the 'critical' level
  160. critical="Major data quality issue found in step {step} ({time})."
  161. ),
  162. final_actions=pb.FinalActions( # An action once the whole validation is done
  163. pb.send_slack_notification(
  164. webhook_url="https://hooks.slack.com/services/your/webhook/url"
  165. )
  166. ),
  167. brief=True, # A generated brief for each step
  168. )
  169. .col_vals_between( # Check numeric ranges
  170. columns=["price", "quantity"],
  171. left=0, right=1000
  172. )
  173. .col_vals_not_null( # Ensure that columns ending with '_id' don't have null values
  174. columns=pb.ends_with("_id")
  175. )
  176. .col_vals_regex( # Validate patterns with regex
  177. columns="email",
  178. pattern="^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$"
  179. )
  180. .col_vals_in_set( # Check categorical values
  181. columns="status",
  182. set=["pending", "shipped", "delivered", "returned"]
  183. )
  184. .conjointly( # Combine multiple conditions
  185. lambda df: pb.expr_col("revenue") == pb.expr_col("price") * pb.expr_col("quantity"),
  186. lambda df: pb.expr_col("tax") >= pb.expr_col("revenue") * 0.05
  187. )
  188. .interrogate()
  189. )
  190. ```
  191. ```
  192. Major data quality issue found in step 7 (2025-04-16 15:03:04.685612+00:00).
  193. ```
  194. ```python
  195. # Get an HTML report you can share with your team
  196. validation.get_tabular_report().show("browser")
  197. ```
  198. <div align="center">
  199. <img src="https://posit-dev.github.io/pointblank/assets/pointblank-sales-data.png" width="800px">
  200. </div>
  201. ```python
  202. # Get a report of failing records from a specific step
  203. validation.get_step_report(i=3).show("browser") # Get failing records from step 3
  204. ```
  205. <div align="center">
  206. <img src="https://posit-dev.github.io/pointblank/assets/pointblank-step-report.png" width="800px">
  207. </div>
  208. <br>
  209. ## Drafting a Plan with an LLM
  210. If you're not sure where to start with a table, [`DraftValidation`](https://posit-dev.github.io/pointblank/user-guide/advanced-validation/draft-validation.html) can have an LLM draft a plan for you. It sends the model a summary of the table (its columns and their types, statistics like the number of missing values, and a few values from each column) rather than the whole table, and gets back a validation plan:
  211. ```python
  212. import pointblank as pb
  213. # Load your data
  214. data = pb.load_dataset("game_revenue") # A sample dataset
  215. # Use DraftValidation to generate a validation plan
  216. pb.DraftValidation(data=data, model="anthropic:claude-opus-4-6")
  217. ```
  218. The output is a plan that you can run as it is:
  219. ```python
  220. import pointblank as pb
  221. # The validation plan
  222. validation = (
  223. pb.Validate(
  224. data=data,
  225. label="Draft Validation",
  226. thresholds=pb.Thresholds(warning=0.10, error=0.25, critical=0.35)
  227. )
  228. .col_vals_in_set(columns="item_type", set=["iap", "ad"])
  229. .col_vals_gt(columns="item_revenue", value=0)
  230. .col_vals_between(columns="session_duration", left=3.2, right=41.0)
  231. .col_count_match(count=11)
  232. .row_count_match(count=2000)
  233. .rows_distinct()
  234. .interrogate()
  235. )
  236. validation
  237. ```
  238. <div align="center">
  239. <img src="https://posit-dev.github.io/pointblank/assets/pointblank-draft-validation-report.png" width="800px">
  240. </div>
  241. <br>
  242. A draft is a starting point. Copy it, then add, remove, and adjust steps for what you know about the data. To change an existing plan with an instruction in plain English, use the [AI validation editor](https://posit-dev.github.io/pointblank/user-guide/advanced-validation/ai-validation-editor.html).
  243. ## YAML Configuration
  244. For teams that need portable, version-controlled validation workflows, Pointblank supports YAML configuration files. This makes it easy to share validation logic across different environments and team members, ensuring everyone is on the same page.
  245. **validation.yaml**
  246. ```yaml
  247. validate:
  248. data: small_table
  249. tbl_name: "small_table"
  250. label: "Getting started validation"
  251. steps:
  252. - col_vals_gt:
  253. columns: "d"
  254. value: 100
  255. - col_vals_le:
  256. columns: "c"
  257. value: 5
  258. - col_exists:
  259. columns: ["date", "date_time"]
  260. ```
  261. **Execute the YAML validation**
  262. ```python
  263. import pointblank as pb
  264. # Run validation from YAML configuration
  265. validation = pb.yaml_interrogate("validation.yaml")
  266. # Get the results just like any other validation
  267. validation.get_tabular_report().show()
  268. ```
  269. This approach is suitable for:
  270. - **CI/CD pipelines**: Store validation rules alongside your code
  271. - **Team collaboration**: Share validation logic in a readable format
  272. - **Environment consistency**: Use the same validation across dev, staging, and production
  273. - **Documentation**: YAML files serve as living documentation of your data quality requirements
  274. ## Command Line Interface (CLI)
  275. Pointblank includes a powerful CLI utility called `pb` that lets you run data validation workflows directly from the command line. Perfect for CI/CD pipelines, scheduled data quality checks, or quick validation tasks.
  276. <div align="center">
  277. <img src="https://posit-dev.github.io/pointblank/assets/termshow/cli-complete-workflow.gif" width="100%">
  278. </div>
  279. **Explore Your Data**
  280. ```bash
  281. # Get a quick preview of your data
  282. pb preview small_table
  283. # Preview data from GitHub URLs
  284. pb preview "https://github.com/user/repo/blob/main/data.csv"
  285. # Check for missing values in Parquet files
  286. pb missing data.parquet
  287. # Generate column summaries from database connections
  288. pb scan "duckdb:///data/sales.ddb::customers"
  289. ```
  290. **Run Essential Validations**
  291. ```bash
  292. # Run validation from YAML configuration file
  293. pb run validation.yaml
  294. # Run validation from Python file
  295. pb run validation.py
  296. # Check for duplicate rows
  297. pb validate small_table --check rows-distinct
  298. # Validate data directly from GitHub
  299. pb validate "https://github.com/user/repo/blob/main/sales.csv" --check col-vals-not-null --column customer_id
  300. # Verify no null values in Parquet datasets
  301. pb validate "data/*.parquet" --check col-vals-not-null --column a
  302. # Extract failing data for debugging
  303. pb validate small_table --check col-vals-gt --column a --value 5 --show-extract
  304. ```
  305. **Integrate with CI/CD**
  306. ```bash
  307. # Use exit codes for automation in one-liner validations (0 = pass, 1 = fail)
  308. pb validate small_table --check rows-distinct --exit-code
  309. # Run validation workflows with exit codes
  310. pb run validation.yaml --exit-code
  311. pb run validation.py --exit-code
  312. ```
  313. Click the following headings to see some terminal recordings of the CLI in action:
  314. <details>
  315. <summary>Getting Started with the Pointblank CLI</summary>
  316. <div align="center">
  317. <img src="https://posit-dev.github.io/pointblank/assets/termshow/cli-getting-started.gif" width="100%">
  318. </div>
  319. </details>
  320. <details>
  321. <summary>Doing Some Data Exploration</summary>
  322. <div align="center">
  323. <img src="https://posit-dev.github.io/pointblank/assets/termshow/cli-data-exploration.gif" width="100%">
  324. </div>
  325. </details>
  326. <details>
  327. <summary>Validating Data with the CLI</summary>
  328. <div align="center">
  329. <img src="https://posit-dev.github.io/pointblank/assets/termshow/cli-essential-validations.gif" width="100%">
  330. </div>
  331. </details>
  332. <details>
  333. <summary>Using Polars in the CLI</summary>
  334. <div align="center">
  335. <img src="https://posit-dev.github.io/pointblank/assets/termshow/cli-using-polars.gif" width="100%">
  336. </div>
  337. </details>
  338. <details>
  339. <summary>Integrating Pointblank with CI/CD</summary>
  340. <div align="center">
  341. <img src="https://posit-dev.github.io/pointblank/assets/termshow/cli-cicd-workflows.gif" width="100%">
  342. </div>
  343. </details>
  344. ## Generate Realistic Test Data
  345. Need test data for your validation workflows? The `generate_dataset()` function creates realistic, locale-aware synthetic data from a schema. It's useful for developing pipelines without production data, running CI tests with reproducible data, or prototyping a workflow before the real data is available.
  346. ```python
  347. import pointblank as pb
  348. # Define a schema with field constraints
  349. schema = pb.Schema(
  350. user_id=pb.int_field(min_val=1, unique=True),
  351. name=pb.string_field(preset="name"),
  352. email=pb.string_field(preset="email"),
  353. age=pb.int_field(min_val=18, max_val=100),
  354. status=pb.string_field(allowed=["active", "pending", "inactive"]),
  355. )
  356. # Generate 10 rows of realistic test data
  357. data = pb.generate_dataset(schema, n=10, seed=23)
  358. pb.preview(data)
  359. ```
  360. <div align="center">
  361. <img src="https://posit-dev.github.io/pointblank/assets/pointblank-data-generation.png" width="800px">
  362. </div>
  363. <br>
  364. The generator has:
  365. - **Over 50 presets**: realistic values like `"name"`, `"email"`, `"address"`, `"phone_number"`, and `"user_agent"`, which agree with each other within a row (the email address is made from the name)
  366. - **Data for 100 countries**: locale-specific values (e.g., `country="DE"` for German addresses), from one country or a mix of them
  367. - **Field constraints**: ranges, patterns, uniqueness, missing values, and allowed values
  368. - **Several output formats**: Polars DataFrames by default, or Pandas (`output="pandas"`) or dictionaries (`output="dict"`)
  369. This makes it easy to generate test data that matches your validation rules. A [pytest fixture](https://posit-dev.github.io/pointblank/user-guide/test-data-generation/pytest-fixture.html) gives each test its own reproducible data. When synthetic data stands in for a real table, [`check_synthetic()`](https://posit-dev.github.io/pointblank/user-guide/table-comparison/checking-synthetic-data.html) compares the two: how closely each column's distribution matches, how varied the rows are, and whether any rows are copies of real ones.
  370. ## Check Data for Model Training
  371. A model learns from everything in its training data, including the boilerplate, the duplicates, and any rows of the test set that leaked in. Pointblank has validation methods and step bundles for these problems. They're ordinary validation steps, so they come with the same reports, thresholds, and actions as any other.
  372. ```python
  373. import pointblank as pb
  374. import polars as pl
  375. # A corpus of web documents for training a language model, one per row
  376. corpus = pl.read_parquet("web_corpus.parquet")
  377. validation = (
  378. pb.Validate(data=corpus, tbl_name="web_corpus")
  379. .col_vals_text_quality(columns="text") # The quality filters of the Gopher models
  380. .rows_near_distinct(columns="text") # Documents that are nearly the same
  381. .col_vals_no_pii(columns="text") # Email addresses, phone and card numbers
  382. .interrogate()
  383. )
  384. # Keep the documents that pass, with one copy of each group of near duplicates
  385. clean = validation.get_sundered_data(type="pass", duplicates="keep_first")
  386. ```
  387. A model is judged fairly only if its splits are independent and alike. The `check_splits()` function looks for rows of a later split that are also in an earlier one, labels that are missing from a split, and columns whose distributions drift between splits:
  388. ```python
  389. check = pb.check_splits(
  390. train=train, valid=valid, test=test, columns="text", label="topic", near=True
  391. )
  392. print("\n".join(check.issues))
  393. ```
  394. ```
  395. 2 rows of 'test' (0.7%) are also in 'train' (1 the same and 1 nearly the same).
  396. 'test' has no rows with the label 'returns' of 'train'.
  397. The shares of the labels of 'test' differ from those of 'train' (PSI 1.75).
  398. The distribution of 'wait_days' in 'test' differs from that in 'train' (PSI 0.798).
  399. ```
  400. Failing a check doesn't always mean that the rows hurt the model. An `Ablation` tests this by experiment. It trains the model without each step's failing rows, compares each version with one that has the same number of random rows removed, and reports whether removing the rows helps, hurts, or makes no clear difference:
  401. ```python
  402. def evaluate(train, *, seed):
  403. ... # Train the model on `train` and return its score on held-out data
  404. ablation = (
  405. pb.Ablation(validation, evaluate=evaluate, metric="accuracy")
  406. .drop_each() # A version without the failing rows of each step
  407. .drop_all() # A version without the rows that fail any step
  408. .run()
  409. )
  410. ```
  411. There's more for training data in the User Guide:
  412. - **[Text checks](https://posit-dev.github.io/pointblank/user-guide/advanced-validation/text-checks.html)**: the language of each document, its length in a tokenizer's tokens, and the format of chat conversations for fine-tuning
  413. - **[RAG checks](https://posit-dev.github.io/pointblank/user-guide/advanced-validation/rag-checks.html)**: the chunks of a retrieval corpus and the questions of its evaluation set
  414. - **[Scored validation](https://posit-dev.github.io/pointblank/user-guide/advanced-validation/scored-validation.html)**: checks of each row's score from a model, such as an embedding similarity, a classifier, or a language model's perplexity
  415. - **[Checking splits](https://posit-dev.github.io/pointblank/user-guide/table-comparison/checking-splits.html)** and **[data ablation](https://posit-dev.github.io/pointblank/user-guide/post-interrogation/data-ablation.html)**: the full guides to the examples above
  416. - **[Data cards](https://posit-dev.github.io/pointblank/user-guide/post-interrogation/data-cards.html)**: a card describing a dataset, with the validation's results as the evidence of its quality
  417. ## More of What Pointblank Does
  418. - **[Segmentation](https://posit-dev.github.io/pointblank/user-guide/validation-plan/segmentation.html)**: run a step separately for each group of rows, like each region or each month
  419. - **[Coded missing values](https://posit-dev.github.io/pointblank/user-guide/validation-plan/validation-methods.html#structured-missingness-with-missing)**: treat codes like `-99` or `"refused"` as missing, by reason, with `MissingSpec`
  420. - **[Validation with an LLM](https://posit-dev.github.io/pointblank/user-guide/validation-plan/validation-methods.html#validating-with-natural-language-prompts)**: check rows against a rule written in plain English, with `prompt()`
  421. - **[Reusable steps](https://posit-dev.github.io/pointblank/user-guide/advanced-validation/composable-steps.html)** and **[plan serialization](https://posit-dev.github.io/pointblank/user-guide/advanced-validation/plan-serialization.html)**: share sets of steps between plans, and write a plan out as Python code or YAML
  422. - **[Quality dimensions and health scores](https://posit-dev.github.io/pointblank/user-guide/post-interrogation/quality-dimensions-and-scoring.html)**: scores for completeness, validity, uniqueness, and other dimensions, rolled up into one score for the table
  423. - **[Data contracts](https://posit-dev.github.io/pointblank/user-guide/contracts-and-pipelines/contracts.html)** and **[pipelines](https://posit-dev.github.io/pointblank/user-guide/contracts-and-pipelines/pipelines.html)**: the schema and rules of a table in one portable contract, enforced on the input and output of a transformation
  424. - **[Table comparison](https://posit-dev.github.io/pointblank/user-guide/table-comparison/comparing-tables.html)**: find the rows that are missing, extra, or changed between two versions of a table, with `pb.compare()`
  425. - **[Profiles and drift](https://posit-dev.github.io/pointblank/user-guide/data-inspection/col-summary-tbl.html#comparing-profiles-for-drift)**: profile a table with `DataScan`, save the profile, and compare later versions with it
  426. - **[Metadata import](https://posit-dev.github.io/pointblank/user-guide/metadata-import/metadata-import.html)** and **[CDISC validation](https://posit-dev.github.io/pointblank/user-guide/metadata-import/cdisc-validation.html)**: turn SPSS, Stata, SAS, Frictionless, and Define-XML metadata into validations, and check clinical data against the CDISC standards
  427. - **[MCP server](https://posit-dev.github.io/pointblank/user-guide/integrations/mcp-quick-start.html)**: validate data by asking an AI assistant, in VS Code or Positron
  428. - **[OpenTelemetry](https://posit-dev.github.io/pointblank/user-guide/integrations/otel-integration.html)**: send validation results to Grafana, Datadog, and other monitoring tools
  429. ## Documentation and Examples
  430. Visit our [documentation site](https://posit-dev.github.io/pointblank) for:
  431. - [The User Guide](https://posit-dev.github.io/pointblank/user-guide/)
  432. - [API reference](https://posit-dev.github.io/pointblank/reference/)
  433. - [Examples](https://posit-dev.github.io/pointblank/examples/)
  434. - [The Pointblog](https://posit-dev.github.io/pointblank/blog/)
  435. ## Join the Community
  436. We'd love to hear from you! Connect with us:
  437. - [GitHub Issues](https://github.com/posit-dev/pointblank/issues) for bug reports and feature requests
  438. - [_Discord server_](https://discord.com/invite/YH7CybCNCQ) for discussions and help
  439. There are many ways to contribute to the development of Pointblank. Some contributions are simple (like fixing typos, improving the documentation, or filing issues for feature requests or problems) and others take more time and care (like answering questions and submitting PRs with code changes). Anything you can do to help is very much appreciated! The [contributing guidelines](https://github.com/posit-dev/pointblank/blob/main/CONTRIBUTING.md) explain how to get started.
  440. ## Technical Details
  441. Pointblank uses [Narwhals](https://github.com/narwhals-dev/narwhals) to work with Polars and Pandas DataFrames, and integrates with [Ibis](https://github.com/ibis-project/ibis) for database and file format support. It also validates PySpark DataFrames. This gives one API for validating tabular data from all of these sources.
  442. ## Pointblank for R
  443. There's also a version of Pointblank for R, which has been around since 2017 and is widely used in the R community. You can find it at https://github.com/rstudio/pointblank.
  444. ## Code of Conduct
  445. Please note that the Pointblank project is released with a [contributor code of conduct](https://www.contributor-covenant.org/version/2/1/code_of_conduct/). <br>By participating in this project you agree to abide by its terms.
  446. ## 📄 License
  447. Pointblank is licensed under the MIT license.
  448. © Posit Software, PBC.
  449. ## 🏛️ Governance
  450. This project is primarily maintained by
  451. [Rich Iannone](https://bsky.app/profile/richmeister.bsky.social). Other authors may occasionally
  452. assist with some of these duties.

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.