-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
34 changed files
with
3,151 additions
and
15,146 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,86 +27,6 @@ | |
"cell_type": "code", | ||
"execution_count": 4, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/html": [ | ||
"\n", | ||
"<style>\n", | ||
" #altair-viz-794f04df820342ad8cb562508ffae4fd.vega-embed {\n", | ||
" width: 100%;\n", | ||
" display: flex;\n", | ||
" }\n", | ||
"\n", | ||
" #altair-viz-794f04df820342ad8cb562508ffae4fd.vega-embed details,\n", | ||
" #altair-viz-794f04df820342ad8cb562508ffae4fd.vega-embed details summary {\n", | ||
" position: relative;\n", | ||
" }\n", | ||
"</style>\n", | ||
"<div id=\"altair-viz-794f04df820342ad8cb562508ffae4fd\"></div>\n", | ||
"<script type=\"text/javascript\">\n", | ||
" var VEGA_DEBUG = (typeof VEGA_DEBUG == \"undefined\") ? {} : VEGA_DEBUG;\n", | ||
" (function(spec, embedOpt){\n", | ||
" let outputDiv = document.currentScript.previousElementSibling;\n", | ||
" if (outputDiv.id !== \"altair-viz-794f04df820342ad8cb562508ffae4fd\") {\n", | ||
" outputDiv = document.getElementById(\"altair-viz-794f04df820342ad8cb562508ffae4fd\");\n", | ||
" }\n", | ||
" const paths = {\n", | ||
" \"vega\": \"https://cdn.jsdelivr.net/npm/vega@5?noext\",\n", | ||
" \"vega-lib\": \"https://cdn.jsdelivr.net/npm/vega-lib?noext\",\n", | ||
" \"vega-lite\": \"https://cdn.jsdelivr.net/npm/[email protected]?noext\",\n", | ||
" \"vega-embed\": \"https://cdn.jsdelivr.net/npm/vega-embed@6?noext\",\n", | ||
" };\n", | ||
"\n", | ||
" function maybeLoadScript(lib, version) {\n", | ||
" var key = `${lib.replace(\"-\", \"\")}_version`;\n", | ||
" return (VEGA_DEBUG[key] == version) ?\n", | ||
" Promise.resolve(paths[lib]) :\n", | ||
" new Promise(function(resolve, reject) {\n", | ||
" var s = document.createElement('script');\n", | ||
" document.getElementsByTagName(\"head\")[0].appendChild(s);\n", | ||
" s.async = true;\n", | ||
" s.onload = () => {\n", | ||
" VEGA_DEBUG[key] = version;\n", | ||
" return resolve(paths[lib]);\n", | ||
" };\n", | ||
" s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n", | ||
" s.src = paths[lib];\n", | ||
" });\n", | ||
" }\n", | ||
"\n", | ||
" function showError(err) {\n", | ||
" outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n", | ||
" throw err;\n", | ||
" }\n", | ||
"\n", | ||
" function displayChart(vegaEmbed) {\n", | ||
" vegaEmbed(outputDiv, spec, embedOpt)\n", | ||
" .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n", | ||
" }\n", | ||
"\n", | ||
" if(typeof define === \"function\" && define.amd) {\n", | ||
" requirejs.config({paths});\n", | ||
" require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n", | ||
" } else {\n", | ||
" maybeLoadScript(\"vega\", \"5\")\n", | ||
" .then(() => maybeLoadScript(\"vega-lite\", \"5.8.0\"))\n", | ||
" .then(() => maybeLoadScript(\"vega-embed\", \"6\"))\n", | ||
" .catch(showError)\n", | ||
" .then(() => displayChart(vegaEmbed));\n", | ||
" }\n", | ||
" })({\"config\": {\"view\": {\"continuousWidth\": 400, \"continuousHeight\": 300}}, \"layer\": [{\"mark\": \"rect\", \"encoding\": {\"color\": {\"field\": \"completeness\", \"legend\": null, \"scale\": {\"scheme\": \"darkred\", \"zero\": true}, \"type\": \"quantitative\"}, \"tooltip\": [{\"field\": \"source_dataset\", \"title\": \"Source dataset\", \"type\": \"nominal\"}, {\"field\": \"total_rows_inc_nulls\", \"format\": \",\", \"title\": \"# of records\", \"type\": \"quantitative\"}, {\"field\": \"column_name\", \"title\": \"Column name\", \"type\": \"nominal\"}, {\"field\": \"total_null_rows\", \"format\": \",\", \"title\": \"# of nulls\", \"type\": \"quantitative\"}, {\"field\": \"completeness\", \"format\": \".1%\", \"type\": \"quantitative\"}], \"x\": {\"axis\": {\"labelAngle\": 20}, \"field\": \"column_name\", \"sort\": {\"field\": \"mean_comp\", \"order\": \"descending\"}, \"title\": \"Column name\", \"type\": \"nominal\"}, \"y\": {\"field\": \"source_dataset\", \"title\": \"Source dataset\", \"type\": \"nominal\"}}, \"title\": \"Column completeness by source dataset\", \"transform\": [{\"joinaggregate\": [{\"op\": \"mean\", \"field\": \"completeness\", \"as\": \"mean_comp\"}], \"groupby\": [\"column_name\"]}]}, {\"mark\": {\"type\": \"text\"}, \"encoding\": {\"color\": {\"condition\": {\"test\": \"datum['completeness'] < 0.5\", \"value\": \"white\"}, \"value\": \"black\"}, \"text\": {\"field\": \"completeness\", \"format\": \".0%\", \"type\": \"quantitative\"}, \"x\": {\"axis\": {\"labelAngle\": 0}, \"field\": \"column_name\", \"sort\": {\"field\": \"mean_comp\", \"order\": \"descending\"}, \"type\": \"nominal\"}, \"y\": {\"field\": \"source_dataset\", \"type\": \"nominal\"}}, \"transform\": [{\"joinaggregate\": [{\"op\": \"mean\", \"field\": \"completeness\", \"as\": \"mean_comp\"}], \"groupby\": [\"column_name\"]}]}], \"data\": {\"name\": \"data-11261f6de8ec59fe3e6da9e6afeaddcc\"}, \"height\": {\"step\": 40}, \"width\": {\"step\": 40}, \"$schema\": \"https://vega.github.io/schema/vega-lite/v5.9.3.json\", \"datasets\": {\"data-11261f6de8ec59fe3e6da9e6afeaddcc\": [{\"source_dataset\": \"df_left\", \"column_name\": \"first_name\", \"total_null_rows\": 79, \"total_rows_inc_nulls\": 500, \"completeness\": 0.8420000076293945}, {\"source_dataset\": \"df_right\", \"column_name\": \"first_name\", \"total_null_rows\": 90, \"total_rows_inc_nulls\": 500, \"completeness\": 0.8199999928474426}, {\"source_dataset\": \"df_left\", \"column_name\": \"surname\", \"total_null_rows\": 93, \"total_rows_inc_nulls\": 500, \"completeness\": 0.8140000104904175}, {\"source_dataset\": \"df_right\", \"column_name\": \"surname\", \"total_null_rows\": 88, \"total_rows_inc_nulls\": 500, \"completeness\": 0.8240000009536743}, {\"source_dataset\": \"df_left\", \"column_name\": \"dob\", \"total_null_rows\": 0, \"total_rows_inc_nulls\": 500, \"completeness\": 1.0}, {\"source_dataset\": \"df_right\", \"column_name\": \"dob\", \"total_null_rows\": 0, \"total_rows_inc_nulls\": 500, \"completeness\": 1.0}, {\"source_dataset\": \"df_left\", \"column_name\": \"city\", \"total_null_rows\": 93, \"total_rows_inc_nulls\": 500, \"completeness\": 0.8140000104904175}, {\"source_dataset\": \"df_right\", \"column_name\": \"city\", \"total_null_rows\": 94, \"total_rows_inc_nulls\": 500, \"completeness\": 0.8119999766349792}, {\"source_dataset\": \"df_left\", \"column_name\": \"email\", \"total_null_rows\": 109, \"total_rows_inc_nulls\": 500, \"completeness\": 0.7820000052452087}, {\"source_dataset\": \"df_right\", \"column_name\": \"email\", \"total_null_rows\": 102, \"total_rows_inc_nulls\": 500, \"completeness\": 0.7960000038146973}]}}, {\"mode\": \"vega-lite\"});\n", | ||
"</script>" | ||
], | ||
"text/plain": [ | ||
"alt.LayerChart(...)" | ||
] | ||
}, | ||
"execution_count": 4, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"from splink.duckdb.linker import DuckDBLinker\n", | ||
"import splink.duckdb.comparison_library as cl\n", | ||
|
@@ -138,7 +58,8 @@ | |
"linker = DuckDBLinker([df_l, df_r], settings, input_table_aliases=[\"df_left\", \"df_right\"])\n", | ||
"\n", | ||
"linker.completeness_chart(cols=[\"first_name\", \"surname\", \"dob\", \"city\", \"email\"])" | ||
] | ||
], | ||
"outputs": [] | ||
}, | ||
{ | ||
"attachments": {}, | ||
|
Oops, something went wrong.