Skip to content

Commit 317c6b7

Browse files
committed
✏️ Beautify
1 parent 316fa92 commit 317c6b7

File tree

1 file changed

+151
-23
lines changed

1 file changed

+151
-23
lines changed

docs/clean-prep/voluptuous.ipynb

Lines changed: 151 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,15 @@
2727
{
2828
"cell_type": "code",
2929
"execution_count": 1,
30-
"metadata": {},
30+
"metadata": {
31+
"execution": {
32+
"iopub.execute_input": "2025-11-18T22:31:17.573145Z",
33+
"iopub.status.busy": "2025-11-18T22:31:17.572855Z",
34+
"iopub.status.idle": "2025-11-18T22:31:18.092601Z",
35+
"shell.execute_reply": "2025-11-18T22:31:18.092331Z",
36+
"shell.execute_reply.started": "2025-11-18T22:31:17.573125Z"
37+
}
38+
},
3139
"outputs": [],
3240
"source": [
3341
"import logging\n",
@@ -62,7 +70,15 @@
6270
{
6371
"cell_type": "code",
6472
"execution_count": 2,
65-
"metadata": {},
73+
"metadata": {
74+
"execution": {
75+
"iopub.execute_input": "2025-11-18T22:31:18.093348Z",
76+
"iopub.status.busy": "2025-11-18T22:31:18.093184Z",
77+
"iopub.status.idle": "2025-11-18T22:31:18.095343Z",
78+
"shell.execute_reply": "2025-11-18T22:31:18.094962Z",
79+
"shell.execute_reply.started": "2025-11-18T22:31:18.093338Z"
80+
}
81+
},
6682
"outputs": [],
6783
"source": [
6884
"logger = logging.getLogger(0)\n",
@@ -80,7 +96,15 @@
8096
{
8197
"cell_type": "code",
8298
"execution_count": 3,
83-
"metadata": {},
99+
"metadata": {
100+
"execution": {
101+
"iopub.execute_input": "2025-11-18T22:31:18.095921Z",
102+
"iopub.status.busy": "2025-11-18T22:31:18.095827Z",
103+
"iopub.status.idle": "2025-11-18T22:31:18.425513Z",
104+
"shell.execute_reply": "2025-11-18T22:31:18.424671Z",
105+
"shell.execute_reply.started": "2025-11-18T22:31:18.095914Z"
106+
}
107+
},
84108
"outputs": [],
85109
"source": [
86110
"sales = pd.read_csv('https://raw.githubusercontent.com/kjam/data-cleaning-101/master/data/sales_data.csv')"
@@ -96,7 +120,15 @@
96120
{
97121
"cell_type": "code",
98122
"execution_count": 4,
99-
"metadata": {},
123+
"metadata": {
124+
"execution": {
125+
"iopub.execute_input": "2025-11-18T22:31:18.426847Z",
126+
"iopub.status.busy": "2025-11-18T22:31:18.426587Z",
127+
"iopub.status.idle": "2025-11-18T22:31:18.442451Z",
128+
"shell.execute_reply": "2025-11-18T22:31:18.441991Z",
129+
"shell.execute_reply.started": "2025-11-18T22:31:18.426831Z"
130+
}
131+
},
100132
"outputs": [
101133
{
102134
"data": {
@@ -211,7 +243,15 @@
211243
{
212244
"cell_type": "code",
213245
"execution_count": 5,
214-
"metadata": {},
246+
"metadata": {
247+
"execution": {
248+
"iopub.execute_input": "2025-11-18T22:31:18.443750Z",
249+
"iopub.status.busy": "2025-11-18T22:31:18.443370Z",
250+
"iopub.status.idle": "2025-11-18T22:31:18.448128Z",
251+
"shell.execute_reply": "2025-11-18T22:31:18.447641Z",
252+
"shell.execute_reply.started": "2025-11-18T22:31:18.443732Z"
253+
}
254+
},
215255
"outputs": [
216256
{
217257
"data": {
@@ -247,7 +287,15 @@
247287
{
248288
"cell_type": "code",
249289
"execution_count": 6,
250-
"metadata": {},
290+
"metadata": {
291+
"execution": {
292+
"iopub.execute_input": "2025-11-18T22:31:18.450998Z",
293+
"iopub.status.busy": "2025-11-18T22:31:18.450836Z",
294+
"iopub.status.idle": "2025-11-18T22:31:18.453121Z",
295+
"shell.execute_reply": "2025-11-18T22:31:18.452782Z",
296+
"shell.execute_reply.started": "2025-11-18T22:31:18.450982Z"
297+
}
298+
},
251299
"outputs": [],
252300
"source": [
253301
"schema = Schema(\n",
@@ -261,7 +309,15 @@
261309
{
262310
"cell_type": "code",
263311
"execution_count": 7,
264-
"metadata": {},
312+
"metadata": {
313+
"execution": {
314+
"iopub.execute_input": "2025-11-18T22:31:18.453628Z",
315+
"iopub.status.busy": "2025-11-18T22:31:18.453552Z",
316+
"iopub.status.idle": "2025-11-18T22:31:18.478857Z",
317+
"shell.execute_reply": "2025-11-18T22:31:18.478488Z",
318+
"shell.execute_reply.started": "2025-11-18T22:31:18.453621Z"
319+
}
320+
},
265321
"outputs": [
266322
{
267323
"name": "stderr",
@@ -361,7 +417,15 @@
361417
{
362418
"cell_type": "code",
363419
"execution_count": 8,
364-
"metadata": {},
420+
"metadata": {
421+
"execution": {
422+
"iopub.execute_input": "2025-11-18T22:31:18.479687Z",
423+
"iopub.status.busy": "2025-11-18T22:31:18.479594Z",
424+
"iopub.status.idle": "2025-11-18T22:31:18.482224Z",
425+
"shell.execute_reply": "2025-11-18T22:31:18.481893Z",
426+
"shell.execute_reply.started": "2025-11-18T22:31:18.479678Z"
427+
}
428+
},
365429
"outputs": [
366430
{
367431
"data": {
@@ -399,31 +463,55 @@
399463
{
400464
"cell_type": "code",
401465
"execution_count": 9,
402-
"metadata": {},
466+
"metadata": {
467+
"execution": {
468+
"iopub.execute_input": "2025-11-18T22:31:18.482964Z",
469+
"iopub.status.busy": "2025-11-18T22:31:18.482903Z",
470+
"iopub.status.idle": "2025-11-18T22:31:18.484745Z",
471+
"shell.execute_reply": "2025-11-18T22:31:18.484447Z",
472+
"shell.execute_reply.started": "2025-11-18T22:31:18.482958Z"
473+
}
474+
},
403475
"outputs": [],
404476
"source": [
405-
"def ValidDate(fmt=\"%Y-%m-%d %H:%M:%S\"):\n",
477+
"def valid_date(fmt=\"%Y-%m-%d %H:%M:%S\"):\n",
406478
" return lambda v: datetime.strptime(v, fmt)"
407479
]
408480
},
409481
{
410482
"cell_type": "code",
411483
"execution_count": 10,
412-
"metadata": {},
484+
"metadata": {
485+
"execution": {
486+
"iopub.execute_input": "2025-11-18T22:31:18.485394Z",
487+
"iopub.status.busy": "2025-11-18T22:31:18.485245Z",
488+
"iopub.status.idle": "2025-11-18T22:31:18.487196Z",
489+
"shell.execute_reply": "2025-11-18T22:31:18.486926Z",
490+
"shell.execute_reply.started": "2025-11-18T22:31:18.485388Z"
491+
}
492+
},
413493
"outputs": [],
414494
"source": [
415495
"schema = Schema(\n",
416496
" {\n",
417-
" Required(\"timestamp\"): All(ValidDate()),\n",
497+
" Required(\"timestamp\"): All(valid_date()),\n",
418498
" },\n",
419-
" extra=ALLOW_EXTRA,\n",
499+
" extra = ALLOW_EXTRA,\n",
420500
")"
421501
]
422502
},
423503
{
424504
"cell_type": "code",
425505
"execution_count": 11,
426-
"metadata": {},
506+
"metadata": {
507+
"execution": {
508+
"iopub.execute_input": "2025-11-18T22:31:18.487668Z",
509+
"iopub.status.busy": "2025-11-18T22:31:18.487587Z",
510+
"iopub.status.idle": "2025-11-18T22:31:18.494464Z",
511+
"shell.execute_reply": "2025-11-18T22:31:18.494239Z",
512+
"shell.execute_reply.started": "2025-11-18T22:31:18.487661Z"
513+
}
514+
},
427515
"outputs": [],
428516
"source": [
429517
"error_count = 0\n",
@@ -440,7 +528,15 @@
440528
{
441529
"cell_type": "code",
442530
"execution_count": 12,
443-
"metadata": {},
531+
"metadata": {
532+
"execution": {
533+
"iopub.execute_input": "2025-11-18T22:31:18.495261Z",
534+
"iopub.status.busy": "2025-11-18T22:31:18.495136Z",
535+
"iopub.status.idle": "2025-11-18T22:31:18.497949Z",
536+
"shell.execute_reply": "2025-11-18T22:31:18.497655Z",
537+
"shell.execute_reply.started": "2025-11-18T22:31:18.495250Z"
538+
}
539+
},
444540
"outputs": [
445541
{
446542
"data": {
@@ -467,10 +563,18 @@
467563
{
468564
"cell_type": "code",
469565
"execution_count": 13,
470-
"metadata": {},
566+
"metadata": {
567+
"execution": {
568+
"iopub.execute_input": "2025-11-18T22:31:18.498347Z",
569+
"iopub.status.busy": "2025-11-18T22:31:18.498271Z",
570+
"iopub.status.idle": "2025-11-18T22:31:18.500405Z",
571+
"shell.execute_reply": "2025-11-18T22:31:18.500183Z",
572+
"shell.execute_reply.started": "2025-11-18T22:31:18.498341Z"
573+
}
574+
},
471575
"outputs": [],
472576
"source": [
473-
"def ValidDate(fmt=\"%Y-%m-%d %H:%M:%S\"):\n",
577+
"def valid_date(fmt=\"%Y-%m-%d %H:%M:%S\"):\n",
474578
" def validation_func(v):\n",
475579
" try:\n",
476580
" assert datetime.strptime(v, fmt) <= datetime.now()\n",
@@ -483,21 +587,37 @@
483587
{
484588
"cell_type": "code",
485589
"execution_count": 14,
486-
"metadata": {},
590+
"metadata": {
591+
"execution": {
592+
"iopub.execute_input": "2025-11-18T22:31:18.500793Z",
593+
"iopub.status.busy": "2025-11-18T22:31:18.500676Z",
594+
"iopub.status.idle": "2025-11-18T22:31:18.502440Z",
595+
"shell.execute_reply": "2025-11-18T22:31:18.502172Z",
596+
"shell.execute_reply.started": "2025-11-18T22:31:18.500787Z"
597+
}
598+
},
487599
"outputs": [],
488600
"source": [
489601
"schema = Schema(\n",
490602
" {\n",
491-
" Required(\"timestamp\"): All(ValidDate()),\n",
603+
" Required(\"timestamp\"): All(valid_date()),\n",
492604
" },\n",
493-
" extra=ALLOW_EXTRA,\n",
605+
" extra = ALLOW_EXTRA,\n",
494606
")"
495607
]
496608
},
497609
{
498610
"cell_type": "code",
499611
"execution_count": 15,
500-
"metadata": {},
612+
"metadata": {
613+
"execution": {
614+
"iopub.execute_input": "2025-11-18T22:31:18.502983Z",
615+
"iopub.status.busy": "2025-11-18T22:31:18.502885Z",
616+
"iopub.status.idle": "2025-11-18T22:31:18.509278Z",
617+
"shell.execute_reply": "2025-11-18T22:31:18.508890Z",
618+
"shell.execute_reply.started": "2025-11-18T22:31:18.502974Z"
619+
}
620+
},
501621
"outputs": [],
502622
"source": [
503623
"error_count = 0\n",
@@ -514,7 +634,15 @@
514634
{
515635
"cell_type": "code",
516636
"execution_count": 16,
517-
"metadata": {},
637+
"metadata": {
638+
"execution": {
639+
"iopub.execute_input": "2025-11-18T22:31:18.509964Z",
640+
"iopub.status.busy": "2025-11-18T22:31:18.509861Z",
641+
"iopub.status.idle": "2025-11-18T22:31:18.512235Z",
642+
"shell.execute_reply": "2025-11-18T22:31:18.511993Z",
643+
"shell.execute_reply.started": "2025-11-18T22:31:18.509949Z"
644+
}
645+
},
518646
"outputs": [
519647
{
520648
"data": {
@@ -548,7 +676,7 @@
548676
"name": "python",
549677
"nbconvert_exporter": "python",
550678
"pygments_lexer": "ipython3",
551-
"version": "3.11.4"
679+
"version": "3.11.13"
552680
},
553681
"latex_envs": {
554682
"LaTeX_envs_menu_present": true,

0 commit comments

Comments
 (0)