|
27 | 27 | { |
28 | 28 | "cell_type": "code", |
29 | 29 | "execution_count": 1, |
30 | | - "metadata": {}, |
| 30 | + "metadata": { |
| 31 | + "execution": { |
| 32 | + "iopub.execute_input": "2025-11-19T14:38:04.007368Z", |
| 33 | + "iopub.status.busy": "2025-11-19T14:38:04.007203Z", |
| 34 | + "iopub.status.idle": "2025-11-19T14:38:04.449780Z", |
| 35 | + "shell.execute_reply": "2025-11-19T14:38:04.449484Z", |
| 36 | + "shell.execute_reply.started": "2025-11-19T14:38:04.007347Z" |
| 37 | + } |
| 38 | + }, |
31 | 39 | "outputs": [], |
32 | 40 | "source": [ |
33 | 41 | "import logging\n", |
|
62 | 70 | { |
63 | 71 | "cell_type": "code", |
64 | 72 | "execution_count": 2, |
65 | | - "metadata": {}, |
| 73 | + "metadata": { |
| 74 | + "execution": { |
| 75 | + "iopub.execute_input": "2025-11-19T14:38:04.450310Z", |
| 76 | + "iopub.status.busy": "2025-11-19T14:38:04.450179Z", |
| 77 | + "iopub.status.idle": "2025-11-19T14:38:04.452317Z", |
| 78 | + "shell.execute_reply": "2025-11-19T14:38:04.452038Z", |
| 79 | + "shell.execute_reply.started": "2025-11-19T14:38:04.450301Z" |
| 80 | + } |
| 81 | + }, |
66 | 82 | "outputs": [], |
67 | 83 | "source": [ |
68 | 84 | "logger = logging.getLogger(0)\n", |
|
79 | 95 | { |
80 | 96 | "cell_type": "code", |
81 | 97 | "execution_count": 3, |
82 | | - "metadata": {}, |
| 98 | + "metadata": { |
| 99 | + "execution": { |
| 100 | + "iopub.execute_input": "2025-11-19T14:38:04.452881Z", |
| 101 | + "iopub.status.busy": "2025-11-19T14:38:04.452768Z", |
| 102 | + "iopub.status.idle": "2025-11-19T14:38:04.848950Z", |
| 103 | + "shell.execute_reply": "2025-11-19T14:38:04.848149Z", |
| 104 | + "shell.execute_reply.started": "2025-11-19T14:38:04.452869Z" |
| 105 | + } |
| 106 | + }, |
83 | 107 | "outputs": [], |
84 | 108 | "source": [ |
85 | 109 | "sales = pd.read_csv(\n", |
|
97 | 121 | { |
98 | 122 | "cell_type": "code", |
99 | 123 | "execution_count": 4, |
100 | | - "metadata": {}, |
| 124 | + "metadata": { |
| 125 | + "execution": { |
| 126 | + "iopub.execute_input": "2025-11-19T14:38:04.850091Z", |
| 127 | + "iopub.status.busy": "2025-11-19T14:38:04.849817Z", |
| 128 | + "iopub.status.idle": "2025-11-19T14:38:04.864279Z", |
| 129 | + "shell.execute_reply": "2025-11-19T14:38:04.863875Z", |
| 130 | + "shell.execute_reply.started": "2025-11-19T14:38:04.850064Z" |
| 131 | + } |
| 132 | + }, |
101 | 133 | "outputs": [ |
102 | 134 | { |
103 | 135 | "data": { |
|
212 | 244 | { |
213 | 245 | "cell_type": "code", |
214 | 246 | "execution_count": 5, |
215 | | - "metadata": {}, |
| 247 | + "metadata": { |
| 248 | + "execution": { |
| 249 | + "iopub.execute_input": "2025-11-19T14:38:04.865197Z", |
| 250 | + "iopub.status.busy": "2025-11-19T14:38:04.864975Z", |
| 251 | + "iopub.status.idle": "2025-11-19T14:38:04.868287Z", |
| 252 | + "shell.execute_reply": "2025-11-19T14:38:04.867996Z", |
| 253 | + "shell.execute_reply.started": "2025-11-19T14:38:04.865182Z" |
| 254 | + } |
| 255 | + }, |
216 | 256 | "outputs": [ |
217 | 257 | { |
218 | 258 | "data": { |
|
232 | 272 | { |
233 | 273 | "cell_type": "code", |
234 | 274 | "execution_count": 6, |
235 | | - "metadata": {}, |
| 275 | + "metadata": { |
| 276 | + "execution": { |
| 277 | + "iopub.execute_input": "2025-11-19T14:38:04.870019Z", |
| 278 | + "iopub.status.busy": "2025-11-19T14:38:04.869911Z", |
| 279 | + "iopub.status.idle": "2025-11-19T14:38:04.875494Z", |
| 280 | + "shell.execute_reply": "2025-11-19T14:38:04.875138Z", |
| 281 | + "shell.execute_reply.started": "2025-11-19T14:38:04.870011Z" |
| 282 | + } |
| 283 | + }, |
236 | 284 | "outputs": [ |
237 | 285 | { |
238 | 286 | "data": { |
|
268 | 316 | { |
269 | 317 | "cell_type": "code", |
270 | 318 | "execution_count": 7, |
271 | | - "metadata": {}, |
| 319 | + "metadata": { |
| 320 | + "execution": { |
| 321 | + "iopub.execute_input": "2025-11-19T14:38:04.876028Z", |
| 322 | + "iopub.status.busy": "2025-11-19T14:38:04.875902Z", |
| 323 | + "iopub.status.idle": "2025-11-19T14:38:04.878452Z", |
| 324 | + "shell.execute_reply": "2025-11-19T14:38:04.878190Z", |
| 325 | + "shell.execute_reply.started": "2025-11-19T14:38:04.876018Z" |
| 326 | + } |
| 327 | + }, |
272 | 328 | "outputs": [], |
273 | 329 | "source": [ |
274 | 330 | "schema = Schema(\n", |
275 | 331 | " {\n", |
276 | 332 | " Required(\"sale_amount\"): All(float, Range(min=2.50, max=1450.99)),\n", |
277 | 333 | " },\n", |
278 | | - " extra=ALLOW_EXTRA,\n", |
| 334 | + " extra = ALLOW_EXTRA,\n", |
279 | 335 | ")" |
280 | 336 | ] |
281 | 337 | }, |
|
289 | 345 | { |
290 | 346 | "cell_type": "code", |
291 | 347 | "execution_count": 8, |
292 | | - "metadata": {}, |
| 348 | + "metadata": { |
| 349 | + "execution": { |
| 350 | + "iopub.execute_input": "2025-11-19T14:38:04.878780Z", |
| 351 | + "iopub.status.busy": "2025-11-19T14:38:04.878712Z", |
| 352 | + "iopub.status.idle": "2025-11-19T14:38:04.902865Z", |
| 353 | + "shell.execute_reply": "2025-11-19T14:38:04.902576Z", |
| 354 | + "shell.execute_reply.started": "2025-11-19T14:38:04.878773Z" |
| 355 | + } |
| 356 | + }, |
293 | 357 | "outputs": [ |
294 | 358 | { |
295 | 359 | "name": "stderr", |
|
382 | 446 | { |
383 | 447 | "cell_type": "code", |
384 | 448 | "execution_count": 9, |
385 | | - "metadata": {}, |
| 449 | + "metadata": { |
| 450 | + "execution": { |
| 451 | + "iopub.execute_input": "2025-11-19T14:38:04.903435Z", |
| 452 | + "iopub.status.busy": "2025-11-19T14:38:04.903215Z", |
| 453 | + "iopub.status.idle": "2025-11-19T14:38:04.905650Z", |
| 454 | + "shell.execute_reply": "2025-11-19T14:38:04.905288Z", |
| 455 | + "shell.execute_reply.started": "2025-11-19T14:38:04.903423Z" |
| 456 | + } |
| 457 | + }, |
386 | 458 | "outputs": [ |
387 | 459 | { |
388 | 460 | "data": { |
|
420 | 492 | { |
421 | 493 | "cell_type": "code", |
422 | 494 | "execution_count": 10, |
423 | | - "metadata": {}, |
| 495 | + "metadata": { |
| 496 | + "execution": { |
| 497 | + "iopub.execute_input": "2025-11-19T14:38:04.906190Z", |
| 498 | + "iopub.status.busy": "2025-11-19T14:38:04.906111Z", |
| 499 | + "iopub.status.idle": "2025-11-19T14:38:04.908096Z", |
| 500 | + "shell.execute_reply": "2025-11-19T14:38:04.907735Z", |
| 501 | + "shell.execute_reply.started": "2025-11-19T14:38:04.906183Z" |
| 502 | + } |
| 503 | + }, |
424 | 504 | "outputs": [], |
425 | 505 | "source": [ |
426 | | - "def ValidDate(fmt=\"%Y-%m-%d %H:%M:%S\"):\n", |
| 506 | + "def valid_date(fmt=\"%Y-%m-%d %H:%M:%S\"):\n", |
427 | 507 | " return lambda v: datetime.strptime(v, fmt)" |
428 | 508 | ] |
429 | 509 | }, |
430 | 510 | { |
431 | 511 | "cell_type": "code", |
432 | 512 | "execution_count": 11, |
433 | | - "metadata": {}, |
| 513 | + "metadata": { |
| 514 | + "execution": { |
| 515 | + "iopub.execute_input": "2025-11-19T14:38:04.908692Z", |
| 516 | + "iopub.status.busy": "2025-11-19T14:38:04.908613Z", |
| 517 | + "iopub.status.idle": "2025-11-19T14:38:04.910537Z", |
| 518 | + "shell.execute_reply": "2025-11-19T14:38:04.910252Z", |
| 519 | + "shell.execute_reply.started": "2025-11-19T14:38:04.908685Z" |
| 520 | + } |
| 521 | + }, |
434 | 522 | "outputs": [], |
435 | 523 | "source": [ |
436 | 524 | "schema = Schema(\n", |
437 | 525 | " {\n", |
438 | | - " Required(\"timestamp\"): All(ValidDate()),\n", |
| 526 | + " Required(\"timestamp\"): All(valid_date()),\n", |
439 | 527 | " },\n", |
440 | | - " extra=ALLOW_EXTRA,\n", |
| 528 | + " extra = ALLOW_EXTRA,\n", |
441 | 529 | ")" |
442 | 530 | ] |
443 | 531 | }, |
444 | 532 | { |
445 | 533 | "cell_type": "code", |
446 | 534 | "execution_count": 12, |
447 | | - "metadata": {}, |
| 535 | + "metadata": { |
| 536 | + "execution": { |
| 537 | + "iopub.execute_input": "2025-11-19T14:38:04.910877Z", |
| 538 | + "iopub.status.busy": "2025-11-19T14:38:04.910813Z", |
| 539 | + "iopub.status.idle": "2025-11-19T14:38:04.916340Z", |
| 540 | + "shell.execute_reply": "2025-11-19T14:38:04.916070Z", |
| 541 | + "shell.execute_reply.started": "2025-11-19T14:38:04.910871Z" |
| 542 | + } |
| 543 | + }, |
448 | 544 | "outputs": [], |
449 | 545 | "source": [ |
450 | 546 | "error_count = 0\n", |
|
461 | 557 | { |
462 | 558 | "cell_type": "code", |
463 | 559 | "execution_count": 13, |
464 | | - "metadata": {}, |
| 560 | + "metadata": { |
| 561 | + "execution": { |
| 562 | + "iopub.execute_input": "2025-11-19T14:38:04.916766Z", |
| 563 | + "iopub.status.busy": "2025-11-19T14:38:04.916681Z", |
| 564 | + "iopub.status.idle": "2025-11-19T14:38:04.918735Z", |
| 565 | + "shell.execute_reply": "2025-11-19T14:38:04.918464Z", |
| 566 | + "shell.execute_reply.started": "2025-11-19T14:38:04.916759Z" |
| 567 | + } |
| 568 | + }, |
465 | 569 | "outputs": [ |
466 | 570 | { |
467 | 571 | "data": { |
|
488 | 592 | { |
489 | 593 | "cell_type": "code", |
490 | 594 | "execution_count": 14, |
491 | | - "metadata": {}, |
| 595 | + "metadata": { |
| 596 | + "execution": { |
| 597 | + "iopub.execute_input": "2025-11-19T14:38:04.919086Z", |
| 598 | + "iopub.status.busy": "2025-11-19T14:38:04.918980Z", |
| 599 | + "iopub.status.idle": "2025-11-19T14:38:04.920824Z", |
| 600 | + "shell.execute_reply": "2025-11-19T14:38:04.920624Z", |
| 601 | + "shell.execute_reply.started": "2025-11-19T14:38:04.919076Z" |
| 602 | + } |
| 603 | + }, |
492 | 604 | "outputs": [], |
493 | 605 | "source": [ |
494 | | - "def ValidDate(fmt=\"%Y-%m-%d %H:%M:%S\"):\n", |
| 606 | + "def valid_date(fmt=\"%Y-%m-%d %H:%M:%S\"):\n", |
495 | 607 | " def validation_func(v):\n", |
496 | 608 | " try:\n", |
497 | 609 | " assert datetime.strptime(v, fmt) <= datetime.now()\n", |
|
504 | 616 | { |
505 | 617 | "cell_type": "code", |
506 | 618 | "execution_count": 15, |
507 | | - "metadata": {}, |
| 619 | + "metadata": { |
| 620 | + "execution": { |
| 621 | + "iopub.execute_input": "2025-11-19T14:38:04.921148Z", |
| 622 | + "iopub.status.busy": "2025-11-19T14:38:04.921074Z", |
| 623 | + "iopub.status.idle": "2025-11-19T14:38:04.922921Z", |
| 624 | + "shell.execute_reply": "2025-11-19T14:38:04.922717Z", |
| 625 | + "shell.execute_reply.started": "2025-11-19T14:38:04.921134Z" |
| 626 | + } |
| 627 | + }, |
508 | 628 | "outputs": [], |
509 | 629 | "source": [ |
510 | 630 | "schema = Schema(\n", |
511 | 631 | " {\n", |
512 | | - " Required(\"timestamp\"): All(ValidDate()),\n", |
| 632 | + " Required(\"timestamp\"): All(valid_date()),\n", |
513 | 633 | " },\n", |
514 | | - " extra=ALLOW_EXTRA,\n", |
| 634 | + " extra = ALLOW_EXTRA,\n", |
515 | 635 | ")" |
516 | 636 | ] |
517 | 637 | }, |
518 | 638 | { |
519 | 639 | "cell_type": "code", |
520 | 640 | "execution_count": 16, |
521 | | - "metadata": {}, |
| 641 | + "metadata": { |
| 642 | + "execution": { |
| 643 | + "iopub.execute_input": "2025-11-19T14:38:04.923638Z", |
| 644 | + "iopub.status.busy": "2025-11-19T14:38:04.923541Z", |
| 645 | + "iopub.status.idle": "2025-11-19T14:38:04.929434Z", |
| 646 | + "shell.execute_reply": "2025-11-19T14:38:04.929211Z", |
| 647 | + "shell.execute_reply.started": "2025-11-19T14:38:04.923631Z" |
| 648 | + } |
| 649 | + }, |
522 | 650 | "outputs": [], |
523 | 651 | "source": [ |
524 | 652 | "error_count = 0\n", |
|
535 | 663 | { |
536 | 664 | "cell_type": "code", |
537 | 665 | "execution_count": 17, |
538 | | - "metadata": {}, |
| 666 | + "metadata": { |
| 667 | + "execution": { |
| 668 | + "iopub.execute_input": "2025-11-19T14:38:04.929922Z", |
| 669 | + "iopub.status.busy": "2025-11-19T14:38:04.929829Z", |
| 670 | + "iopub.status.idle": "2025-11-19T14:38:04.932315Z", |
| 671 | + "shell.execute_reply": "2025-11-19T14:38:04.932040Z", |
| 672 | + "shell.execute_reply.started": "2025-11-19T14:38:04.929914Z" |
| 673 | + } |
| 674 | + }, |
539 | 675 | "outputs": [ |
540 | 676 | { |
541 | 677 | "data": { |
|
0 commit comments