python-machine-learning-book-2nd-edition icon indicating copy to clipboard operation
python-machine-learning-book-2nd-edition copied to clipboard

Chapter08 python file - reporthook function code fix to prevent div by 0 error

Open teamiceberg opened this issue 4 years ago • 2 comments

Dear author:

The function fails due to div by zero error as duration = 0 initially. I did a simple code change to accommodate this bug. If you find it useful, please merge change.

Also, ignore all my other annotations change. That is for my own learning purposes.

Thank you.

teamiceberg avatar Jan 18 '20 23:01 teamiceberg

Check out this pull request on  ReviewNB

You'll be able to see Jupyter notebook diff and discuss changes. Powered by ReviewNB.

Hello @teamiceberg! Thanks for opening this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 69:1: E303 too many blank lines (4) Line 168:1: E402 module level import not at top of file Line 180:80: E501 line too long (84 > 79 characters) Line 180:85: W291 trailing whitespace Line 181:80: W291 trailing whitespace Line 182:80: E501 line too long (123 > 79 characters) Line 182:124: W291 trailing whitespace Line 183:80: E501 line too long (89 > 79 characters) Line 183:90: W291 trailing whitespace Line 208:1: E402 module level import not at top of file Line 209:1: E402 module level import not at top of file Line 220:39: E231 missing whitespace after ',' Line 220:80: E501 line too long (80 > 79 characters) Line 254:1: E402 module level import not at top of file Line 318:1: W293 blank line contains whitespace Line 412:1: E303 too many blank lines (3) Line 425:1: E303 too many blank lines (4) Line 614:6: E211 whitespace before '(' Line 614:80: E501 line too long (106 > 79 characters)

Line 17:1: W293 blank line contains whitespace Line 56:1: E303 too many blank lines (3) Line 59:1: E402 module level import not at top of file Line 73:1: E402 module level import not at top of file Line 74:1: E402 module level import not at top of file Line 88:1: E402 module level import not at top of file Line 107:1: E402 module level import not at top of file Line 124:1: E402 module level import not at top of file Line 144:1: E402 module level import not at top of file Line 158:1: E402 module level import not at top of file Line 159:1: E402 module level import not at top of file Line 234:1: E402 module level import not at top of file Line 235:1: E402 module level import not at top of file Line 377:1: E303 too many blank lines (3) Line 384:27: E231 missing whitespace after ',' Line 386:80: E501 line too long (80 > 79 characters) Line 402:1: E402 module level import not at top of file Line 455:1: E303 too many blank lines (4) Line 457:80: E501 line too long (91 > 79 characters) Line 497:1: E303 too many blank lines (4) Line 500:1: E402 module level import not at top of file Line 522:1: E402 module level import not at top of file Line 531:80: E501 line too long (210 > 79 characters) Line 537:37: W291 trailing whitespace Line 539:1: E402 module level import not at top of file Line 540:1: E402 module level import not at top of file Line 592:1: E402 module level import not at top of file Line 631:1: E303 too many blank lines (4) Line 642:1: E402 module level import not at top of file Line 643:1: E402 module level import not at top of file Line 691:1: E402 module level import not at top of file Line 710:1: E303 too many blank lines (3) Line 713:1: E402 module level import not at top of file Line 714:1: E402 module level import not at top of file Line 740:1: E402 module level import not at top of file Line 745:33: E127 continuation line over-indented for visual indent Line 762:3: E114 indentation is not a multiple of four (comment) Line 762:3: E116 unexpected indentation (comment) Line 767:1: E303 too many blank lines (4) Line 770:1: E402 module level import not at top of file Line 772:32: W291 trailing whitespace Line 802:1: E303 too many blank lines (4)

Line 98:1: E303 too many blank lines (3) Line 142:1: E303 too many blank lines (4) Line 142:46: W291 trailing whitespace Line 191:1: E302 expected 2 blank lines, found 10 Line 196:28: E231 missing whitespace after ',' Line 196:35: E231 missing whitespace after ',' Line 199:80: E501 line too long (89 > 79 characters) Line 201:5: E265 block comment should start with '# ' Line 201:80: E501 line too long (84 > 79 characters) Line 202:39: E251 unexpected spaces around keyword / parameter equals Line 202:41: E251 unexpected spaces around keyword / parameter equals Line 205:1: E305 expected 2 blank lines after class or function definition, found 1 Line 233:1: E402 module level import not at top of file Line 275:1: E303 too many blank lines (3) Line 278:80: E501 line too long (93 > 79 characters) Line 283:1: E303 too many blank lines (3) Line 286:11: E231 missing whitespace after ',' Line 288:31: E251 unexpected spaces around keyword / parameter equals Line 288:33: E251 unexpected spaces around keyword / parameter equals Line 291:12: E231 missing whitespace after ',' Line 291:26: E231 missing whitespace after ',' Line 294:38: E231 missing whitespace after ',' Line 295:29: E231 missing whitespace after ',' Line 295:41: E251 unexpected spaces around keyword / parameter equals Line 295:43: E251 unexpected spaces around keyword / parameter equals Line 305:11: E231 missing whitespace after ',' Line 307:31: E251 unexpected spaces around keyword / parameter equals Line 307:33: E251 unexpected spaces around keyword / parameter equals Line 307:48: E251 unexpected spaces around keyword / parameter equals Line 307:50: E251 unexpected spaces around keyword / parameter equals Line 310:12: E231 missing whitespace after ',' Line 310:26: E231 missing whitespace after ',' Line 311:38: E231 missing whitespace after ',' Line 312:29: E231 missing whitespace after ',' Line 312:41: E251 unexpected spaces around keyword / parameter equals Line 312:43: E251 unexpected spaces around keyword / parameter equals Line 318:1: E303 too many blank lines (4) Line 338:1: E266 too many leading '#' for block comment Line 378:1: E303 too many blank lines (3) Line 380:67: W291 trailing whitespace Line 390:1: E266 too many leading '#' for block comment Line 390:1: E303 too many blank lines (3) Line 436:1: E303 too many blank lines (5) Line 436:73: W291 trailing whitespace Line 437:54: W291 trailing whitespace Line 440:40: E251 unexpected spaces around keyword / parameter equals Line 440:42: E251 unexpected spaces around keyword / parameter equals Line 446:52: E251 unexpected spaces around keyword / parameter equals Line 446:54: E251 unexpected spaces around keyword / parameter equals Line 460:30: E203 whitespace before ',' Line 461:27: E203 whitespace before ',' Line 461:47: E225 missing whitespace around operator Line 476:52: W291 trailing whitespace Line 477:51: E251 unexpected spaces around keyword / parameter equals Line 477:53: E251 unexpected spaces around keyword / parameter equals Line 504:1: E266 too many leading '#' for block comment Line 594:1: E265 block comment should start with '# ' Line 634:1: E266 too many leading '#' for block comment Line 641:67: W291 trailing whitespace Line 642:73: W291 trailing whitespace Line 643:68: W291 trailing whitespace

Line 120:22: E231 missing whitespace after ',' Line 121:21: E231 missing whitespace after ',' Line 169:1: E265 block comment should start with '# ' Line 193:1: E266 too many leading '#' for block comment Line 224:64: W291 trailing whitespace Line 225:54: W291 trailing whitespace Line 226:80: E501 line too long (95 > 79 characters) Line 240:1: E266 too many leading '#' for block comment Line 246:1: E265 block comment should start with '# ' Line 265:80: E501 line too long (86 > 79 characters) Line 265:87: W291 trailing whitespace Line 266:80: E501 line too long (93 > 79 characters) Line 364:1: E266 too many leading '#' for block comment Line 411:55: W291 trailing whitespace Line 493:1: E303 too many blank lines (3) Line 553:1: E266 too many leading '#' for block comment Line 553:1: E303 too many blank lines (3) Line 604:69: W291 trailing whitespace Line 606:45: W291 trailing whitespace Line 608:1: W293 blank line contains whitespace Line 627:1: E266 too many leading '#' for block comment Line 628:1: E266 too many leading '#' for block comment Line 655:1: E266 too many leading '#' for block comment Line 727:1: E303 too many blank lines (3) Line 758:72: W291 trailing whitespace Line 762:1: E266 too many leading '#' for block comment Line 818:1: E266 too many leading '#' for block comment Line 818:49: W291 trailing whitespace Line 819:1: E266 too many leading '#' for block comment Line 865:10: E225 missing whitespace around operator Line 865:28: E231 missing whitespace after ',' Line 868:27: W291 trailing whitespace Line 871:22: E203 whitespace before ',' Line 873:17: E128 continuation line under-indented for visual indent Line 875:17: E128 continuation line under-indented for visual indent Line 876:1: W293 blank line contains whitespace Line 877:39: E251 unexpected spaces around keyword / parameter equals Line 877:41: E251 unexpected spaces around keyword / parameter equals Line 878:39: E251 unexpected spaces around keyword / parameter equals Line 878:41: E251 unexpected spaces around keyword / parameter equals Line 879:70: E251 unexpected spaces around keyword / parameter equals Line 879:72: E251 unexpected spaces around keyword / parameter equals Line 879:74: E202 whitespace before ')' Line 881:67: W291 trailing whitespace Line 882:18: E127 continuation line over-indented for visual indent Line 882:20: E251 unexpected spaces around keyword / parameter equals Line 882:22: E251 unexpected spaces around keyword / parameter equals

Line 98:1: E265 block comment should start with '# ' Line 106:1: E265 block comment should start with '# ' Line 109:1: E265 block comment should start with '# ' Line 146:1: E265 block comment should start with '# ' Line 157:1: E265 block comment should start with '# ' Line 158:1: E265 block comment should start with '# ' Line 165:57: W291 trailing whitespace Line 166:11: E127 continuation line over-indented for visual indent Line 166:20: E203 whitespace before ',' Line 166:21: E231 missing whitespace after ',' Line 268:1: E266 too many leading '#' for block comment Line 275:1: E265 block comment should start with '# ' Line 281:1: E265 block comment should start with '# ' Line 292:35: E251 unexpected spaces around keyword / parameter equals Line 292:37: E251 unexpected spaces around keyword / parameter equals Line 318:24: E251 unexpected spaces around keyword / parameter equals Line 318:26: E251 unexpected spaces around keyword / parameter equals Line 319:25: E251 unexpected spaces around keyword / parameter equals Line 319:27: E251 unexpected spaces around keyword / parameter equals Line 334:25: E251 unexpected spaces around keyword / parameter equals Line 334:27: E251 unexpected spaces around keyword / parameter equals Line 335:24: E251 unexpected spaces around keyword / parameter equals Line 335:26: E251 unexpected spaces around keyword / parameter equals Line 376:55: W291 trailing whitespace Line 377:1: E266 too many leading '#' for block comment Line 377:60: W291 trailing whitespace Line 378:1: E266 too many leading '#' for block comment Line 399:58: W291 trailing whitespace Line 400:1: E266 too many leading '#' for block comment Line 400:56: W291 trailing whitespace Line 401:1: E266 too many leading '#' for block comment Line 401:49: W291 trailing whitespace Line 402:1: E266 too many leading '#' for block comment Line 402:62: W291 trailing whitespace Line 403:1: E266 too many leading '#' for block comment Line 403:67: W291 trailing whitespace Line 404:1: E266 too many leading '#' for block comment Line 460:34: E251 unexpected spaces around keyword / parameter equals Line 460:36: E251 unexpected spaces around keyword / parameter equals Line 537:1: E303 too many blank lines (3)

Line 121:1: E303 too many blank lines (4) Line 300:61: W291 trailing whitespace Line 326:50: W291 trailing whitespace Line 382:1: E303 too many blank lines (3) Line 438:1: E303 too many blank lines (3) Line 443:1: E303 too many blank lines (3) Line 546:34: W291 trailing whitespace Line 549:1: E266 too many leading '#' for block comment Line 549:29: W291 trailing whitespace Line 559:1: E266 too many leading '#' for block comment Line 572:1: E266 too many leading '#' for block comment Line 572:1: E303 too many blank lines (4) Line 625:1: E303 too many blank lines (5) Line 664:1: E303 too many blank lines (3) Line 670:70: E231 missing whitespace after ',' Line 693:80: E501 line too long (82 > 79 characters)

Line 101:53: E225 missing whitespace around operator Line 101:62: E231 missing whitespace after ',' Line 101:68: E231 missing whitespace after ',' Line 101:80: E501 line too long (80 > 79 characters) Line 102:20: E203 whitespace before ':' Line 102:21: E701 multiple statements on one line (colon)

pep8speaks avatar Jan 18 '20 23:01 pep8speaks