├── .gitignore ├── .gitpod.yml ├── .vscode └── settings.json ├── README.md ├── examples ├── Figure_1.png ├── Figure_2.png └── Figure_3.png ├── fcc-forum-pageviews.csv ├── main.py ├── requirements.txt ├── test_module.py └── time_series_visualizer.py /.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__/ 2 | -------------------------------------------------------------------------------- /.gitpod.yml: -------------------------------------------------------------------------------- 1 | image: gitpod/workspace-python-3.8 2 | 3 | tasks: 4 | - init: pip install -r requirements.txt 5 | 6 | vscode: 7 | extensions: 8 | - https://github.com/freeCodeCamp/freecodecamp-dark-vscode-theme/releases/download/v1.0.0/freecodecamp-dark-vscode-theme-1.0.0.vsix 9 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "workbench.colorTheme": "freeCodeCamp Dark Theme" 3 | } 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Page View Time Series Visualizer 2 | 3 | This is the boilerplate for the Page View Time Series Visualizer project. Instructions for building your project can be found at https://www.freecodecamp.org/learn/data-analysis-with-python/data-analysis-with-python-projects/page-view-time-series-visualizer 4 | -------------------------------------------------------------------------------- /examples/Figure_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/freeCodeCamp/boilerplate-page-view-time-series-visualizer/10d2fe8058be34cdf47d730d03e5ee1500bf23cf/examples/Figure_1.png -------------------------------------------------------------------------------- /examples/Figure_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/freeCodeCamp/boilerplate-page-view-time-series-visualizer/10d2fe8058be34cdf47d730d03e5ee1500bf23cf/examples/Figure_2.png -------------------------------------------------------------------------------- /examples/Figure_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/freeCodeCamp/boilerplate-page-view-time-series-visualizer/10d2fe8058be34cdf47d730d03e5ee1500bf23cf/examples/Figure_3.png -------------------------------------------------------------------------------- /fcc-forum-pageviews.csv: -------------------------------------------------------------------------------- 1 | date,value 2 | 2016-05-09,1201 3 | 2016-05-10,2329 4 | 2016-05-11,1716 5 | 2016-05-12,10539 6 | 2016-05-13,6933 7 | 2016-05-14,3127 8 | 2016-05-15,2927 9 | 2016-05-16,2591 10 | 2016-05-17,3403 11 | 2016-05-18,5410 12 | 2016-05-19,19736 13 | 2016-05-20,17491 14 | 2016-05-21,13370 15 | 2016-05-22,13158 16 | 2016-05-23,13887 17 | 2016-05-24,15336 18 | 2016-05-25,14779 19 | 2016-05-26,18060 20 | 2016-05-27,19997 21 | 2016-05-28,19044 22 | 2016-05-29,20325 23 | 2016-05-30,16607 24 | 2016-05-31,16616 25 | 2016-06-01,13007 26 | 2016-06-02,10329 27 | 2016-06-03,10155 28 | 2016-06-04,7431 29 | 2016-06-05,16031 30 | 2016-06-06,16621 31 | 2016-06-07,18335 32 | 2016-06-08,18072 33 | 2016-06-09,18139 34 | 2016-06-10,17087 35 | 2016-06-11,16098 36 | 2016-06-12,16147 37 | 2016-06-13,17570 38 | 2016-06-14,19395 39 | 2016-06-15,18584 40 | 2016-06-16,17628 41 | 2016-06-17,21691 42 | 2016-06-18,21681 43 | 2016-06-19,19204 44 | 2016-06-20,28508 45 | 2016-06-21,26805 46 | 2016-06-22,21424 47 | 2016-06-23,19820 48 | 2016-06-24,19230 49 | 2016-06-25,21923 50 | 2016-06-26,22685 51 | 2016-06-27,24278 52 | 2016-06-28,21423 53 | 2016-06-29,27734 54 | 2016-06-30,26696 55 | 2016-07-01,28372 56 | 2016-07-02,26393 57 | 2016-07-03,27011 58 | 2016-07-04,24236 59 | 2016-07-05,23843 60 | 2016-07-06,24374 61 | 2016-07-07,28507 62 | 2016-07-08,31184 63 | 2016-07-09,27404 64 | 2016-07-10,26079 65 | 2016-07-11,20339 66 | 2016-07-12,21510 67 | 2016-07-13,20391 68 | 2016-07-14,23278 69 | 2016-07-15,22815 70 | 2016-07-16,20261 71 | 2016-07-17,20331 72 | 2016-07-18,19703 73 | 2016-07-19,15445 74 | 2016-07-20,22046 75 | 2016-07-21,27290 76 | 2016-07-22,28662 77 | 2016-07-23,25053 78 | 2016-07-24,19733 79 | 2016-07-25,25646 80 | 2016-07-26,19637 81 | 2016-07-27,23587 82 | 2016-07-28,25719 83 | 2016-07-29,21667 84 | 2016-07-30,16002 85 | 2016-07-31,16223 86 | 2016-08-01,20947 87 | 2016-08-02,20345 88 | 2016-08-03,24118 89 | 2016-08-04,24951 90 | 2016-08-05,27880 91 | 2016-08-06,20900 92 | 2016-08-07,23536 93 | 2016-08-08,24471 94 | 2016-08-09,24828 95 | 2016-08-10,31583 96 | 2016-08-11,30393 97 | 2016-08-12,29488 98 | 2016-08-13,26206 99 | 2016-08-14,29686 100 | 2016-08-15,32229 101 | 2016-08-16,34396 102 | 2016-08-17,43003 103 | 2016-08-18,35206 104 | 2016-08-19,32362 105 | 2016-08-20,37583 106 | 2016-08-21,36559 107 | 2016-08-22,36701 108 | 2016-08-23,32726 109 | 2016-08-24,29315 110 | 2016-08-25,32786 111 | 2016-08-26,35489 112 | 2016-08-27,36366 113 | 2016-08-28,33765 114 | 2016-08-29,36915 115 | 2016-08-30,39619 116 | 2016-08-31,38173 117 | 2016-09-01,40709 118 | 2016-09-02,37609 119 | 2016-09-03,30250 120 | 2016-09-04,36077 121 | 2016-09-05,35320 122 | 2016-09-06,39098 123 | 2016-09-07,43401 124 | 2016-09-08,40258 125 | 2016-09-09,44787 126 | 2016-09-10,44586 127 | 2016-09-11,39262 128 | 2016-09-12,42667 129 | 2016-09-13,49746 130 | 2016-09-14,43645 131 | 2016-09-15,38780 132 | 2016-09-16,36125 133 | 2016-09-17,31797 134 | 2016-09-18,32304 135 | 2016-09-19,36840 136 | 2016-09-20,37441 137 | 2016-09-21,38492 138 | 2016-09-22,38324 139 | 2016-09-23,44985 140 | 2016-09-24,37708 141 | 2016-09-25,39081 142 | 2016-09-26,41089 143 | 2016-09-27,41296 144 | 2016-09-28,53158 145 | 2016-09-29,70669 146 | 2016-09-30,58802 147 | 2016-10-01,49179 148 | 2016-10-02,44043 149 | 2016-10-03,32660 150 | 2016-10-04,41797 151 | 2016-10-05,39348 152 | 2016-10-06,23874 153 | 2016-10-07,25963 154 | 2016-10-08,23848 155 | 2016-10-09,23573 156 | 2016-10-10,27459 157 | 2016-10-11,27601 158 | 2016-10-12,26521 159 | 2016-10-13,24865 160 | 2016-10-14,24934 161 | 2016-10-15,20609 162 | 2016-10-16,22301 163 | 2016-10-17,26623 164 | 2016-10-18,25319 165 | 2016-10-19,29076 166 | 2016-10-20,23217 167 | 2016-10-21,22343 168 | 2016-10-22,19571 169 | 2016-10-23,20457 170 | 2016-10-24,25670 171 | 2016-10-25,27317 172 | 2016-10-26,26489 173 | 2016-10-27,27207 174 | 2016-10-28,23258 175 | 2016-10-29,22975 176 | 2016-10-30,24828 177 | 2016-10-31,26423 178 | 2016-11-01,25856 179 | 2016-11-02,26565 180 | 2016-11-03,30183 181 | 2016-11-04,28981 182 | 2016-11-05,25849 183 | 2016-11-06,25287 184 | 2016-11-07,27790 185 | 2016-11-08,26744 186 | 2016-11-09,25489 187 | 2016-11-10,117906 188 | 2016-11-11,159186 189 | 2016-11-12,33775 190 | 2016-11-13,22762 191 | 2016-11-14,24449 192 | 2016-11-15,30817 193 | 2016-11-16,33673 194 | 2016-11-17,35712 195 | 2016-11-18,50298 196 | 2016-11-19,42964 197 | 2016-11-20,47789 198 | 2016-11-21,52663 199 | 2016-11-22,51329 200 | 2016-11-23,48490 201 | 2016-11-24,46822 202 | 2016-11-25,29973 203 | 2016-11-26,25239 204 | 2016-11-27,27955 205 | 2016-11-28,31749 206 | 2016-11-29,29694 207 | 2016-11-30,27470 208 | 2016-12-01,32666 209 | 2016-12-02,36075 210 | 2016-12-03,31115 211 | 2016-12-04,23536 212 | 2016-12-05,25527 213 | 2016-12-06,28078 214 | 2016-12-07,31498 215 | 2016-12-08,28919 216 | 2016-12-09,27988 217 | 2016-12-10,25698 218 | 2016-12-11,28806 219 | 2016-12-12,31131 220 | 2016-12-13,32777 221 | 2016-12-14,32015 222 | 2016-12-15,42333 223 | 2016-12-16,28715 224 | 2016-12-17,23503 225 | 2016-12-18,23391 226 | 2016-12-19,28247 227 | 2016-12-20,29969 228 | 2016-12-21,28531 229 | 2016-12-22,29442 230 | 2016-12-23,24747 231 | 2016-12-24,20227 232 | 2016-12-25,19035 233 | 2016-12-26,23076 234 | 2016-12-27,25138 235 | 2016-12-28,28424 236 | 2016-12-29,27197 237 | 2016-12-30,24804 238 | 2016-12-31,20197 239 | 2017-01-01,26185 240 | 2017-01-02,28560 241 | 2017-01-03,31525 242 | 2017-01-04,28955 243 | 2017-01-05,35024 244 | 2017-01-06,37353 245 | 2017-01-07,33233 246 | 2017-01-08,30571 247 | 2017-01-09,32352 248 | 2017-01-10,33550 249 | 2017-01-11,35142 250 | 2017-01-12,30960 251 | 2017-01-13,33266 252 | 2017-01-14,34418 253 | 2017-01-15,26987 254 | 2017-01-16,37466 255 | 2017-01-17,32119 256 | 2017-01-18,30628 257 | 2017-01-19,32362 258 | 2017-01-20,30079 259 | 2017-01-21,29555 260 | 2017-01-22,33041 261 | 2017-01-23,37958 262 | 2017-01-24,33083 263 | 2017-01-25,31990 264 | 2017-01-26,32775 265 | 2017-01-27,29665 266 | 2017-01-28,28045 267 | 2017-01-29,55875 268 | 2017-01-30,32284 269 | 2017-01-31,31334 270 | 2017-02-01,30124 271 | 2017-02-02,31924 272 | 2017-02-03,27526 273 | 2017-02-04,24955 274 | 2017-02-05,30714 275 | 2017-02-06,33347 276 | 2017-02-07,37804 277 | 2017-02-08,33664 278 | 2017-02-09,36645 279 | 2017-02-10,29067 280 | 2017-02-11,24300 281 | 2017-02-12,29004 282 | 2017-02-13,32764 283 | 2017-02-14,33632 284 | 2017-02-15,30330 285 | 2017-02-16,30942 286 | 2017-02-17,28747 287 | 2017-02-18,26708 288 | 2017-02-19,26266 289 | 2017-02-20,37017 290 | 2017-02-21,32837 291 | 2017-02-22,36489 292 | 2017-02-23,33894 293 | 2017-02-24,33952 294 | 2017-02-25,28785 295 | 2017-02-26,27813 296 | 2017-02-27,31283 297 | 2017-02-28,30633 298 | 2017-03-01,33258 299 | 2017-03-02,29234 300 | 2017-03-03,28912 301 | 2017-03-04,23709 302 | 2017-03-05,23970 303 | 2017-03-06,31878 304 | 2017-03-07,30962 305 | 2017-03-08,29290 306 | 2017-03-09,28652 307 | 2017-03-10,27218 308 | 2017-03-11,25319 309 | 2017-03-12,26416 310 | 2017-03-13,28475 311 | 2017-03-14,31696 312 | 2017-03-15,31997 313 | 2017-03-16,30443 314 | 2017-03-17,28411 315 | 2017-03-18,23845 316 | 2017-03-19,25132 317 | 2017-03-20,29705 318 | 2017-03-21,26941 319 | 2017-03-22,34204 320 | 2017-03-23,31416 321 | 2017-03-24,30360 322 | 2017-03-25,25596 323 | 2017-03-26,36487 324 | 2017-03-27,35773 325 | 2017-03-28,30866 326 | 2017-03-29,29235 327 | 2017-03-30,30333 328 | 2017-03-31,30709 329 | 2017-04-01,23762 330 | 2017-04-02,24969 331 | 2017-04-03,33614 332 | 2017-04-04,35923 333 | 2017-04-05,31198 334 | 2017-04-06,32455 335 | 2017-04-07,28156 336 | 2017-04-08,24879 337 | 2017-04-09,23871 338 | 2017-04-10,30624 339 | 2017-04-11,33896 340 | 2017-04-12,31360 341 | 2017-04-13,27592 342 | 2017-04-14,31720 343 | 2017-04-15,27999 344 | 2017-04-16,27037 345 | 2017-04-17,31801 346 | 2017-04-18,30731 347 | 2017-04-19,56682 348 | 2017-04-20,32813 349 | 2017-04-21,28301 350 | 2017-04-22,25124 351 | 2017-04-23,24741 352 | 2017-04-24,36291 353 | 2017-04-25,32177 354 | 2017-04-26,30675 355 | 2017-04-27,51977 356 | 2017-04-28,26987 357 | 2017-04-29,23219 358 | 2017-04-30,25788 359 | 2017-05-01,30580 360 | 2017-05-02,30175 361 | 2017-05-03,29907 362 | 2017-05-04,32716 363 | 2017-05-05,32642 364 | 2017-05-06,28752 365 | 2017-05-07,25898 366 | 2017-05-08,39028 367 | 2017-05-09,46944 368 | 2017-05-10,39860 369 | 2017-05-11,46743 370 | 2017-05-12,29197 371 | 2017-05-13,26105 372 | 2017-05-14,28039 373 | 2017-05-15,35563 374 | 2017-05-16,35443 375 | 2017-05-17,35114 376 | 2017-05-18,37373 377 | 2017-05-19,31868 378 | 2017-05-20,30077 379 | 2017-05-21,25970 380 | 2017-05-22,32100 381 | 2017-05-23,35395 382 | 2017-05-24,39844 383 | 2017-05-25,44889 384 | 2017-05-26,39374 385 | 2017-05-27,26679 386 | 2017-05-28,26758 387 | 2017-05-29,32635 388 | 2017-05-30,37686 389 | 2017-05-31,48219 390 | 2017-06-01,43336 391 | 2017-06-02,50825 392 | 2017-06-03,44143 393 | 2017-06-04,44193 394 | 2017-06-05,56336 395 | 2017-06-06,47989 396 | 2017-06-07,47885 397 | 2017-06-08,43983 398 | 2017-06-09,44776 399 | 2017-06-10,42018 400 | 2017-06-11,34311 401 | 2017-06-12,39694 402 | 2017-06-13,41098 403 | 2017-06-14,38289 404 | 2017-06-15,35351 405 | 2017-06-16,39123 406 | 2017-06-17,40941 407 | 2017-06-18,33112 408 | 2017-06-19,38418 409 | 2017-06-20,45829 410 | 2017-06-21,42424 411 | 2017-06-22,54267 412 | 2017-06-23,38842 413 | 2017-06-24,40668 414 | 2017-06-25,46618 415 | 2017-06-26,43904 416 | 2017-06-27,46568 417 | 2017-06-28,52375 418 | 2017-06-29,41553 419 | 2017-06-30,48456 420 | 2017-07-01,37928 421 | 2017-07-02,47547 422 | 2017-07-03,78839 423 | 2017-07-04,82957 424 | 2017-07-05,79604 425 | 2017-07-06,70436 426 | 2017-07-07,55682 427 | 2017-07-08,47133 428 | 2017-07-09,52715 429 | 2017-07-10,60916 430 | 2017-07-11,58470 431 | 2017-07-12,67336 432 | 2017-07-13,72532 433 | 2017-07-14,78133 434 | 2017-07-15,75974 435 | 2017-07-16,77304 436 | 2017-07-17,74115 437 | 2017-07-18,78235 438 | 2017-07-19,83925 439 | 2017-07-20,62996 440 | 2017-07-21,65973 441 | 2017-07-22,60364 442 | 2017-07-23,57083 443 | 2017-07-24,63076 444 | 2017-07-25,78896 445 | 2017-07-26,61290 446 | 2017-07-27,68910 447 | 2017-07-28,77848 448 | 2017-07-29,57041 449 | 2017-07-30,44213 450 | 2017-07-31,62541 451 | 2017-08-01,46685 452 | 2017-08-02,51019 453 | 2017-08-03,49166 454 | 2017-08-04,56280 455 | 2017-08-05,44482 456 | 2017-08-06,42476 457 | 2017-08-07,47298 458 | 2017-08-08,47995 459 | 2017-08-09,46436 460 | 2017-08-10,43221 461 | 2017-08-11,48098 462 | 2017-08-12,43524 463 | 2017-08-13,40913 464 | 2017-08-14,48547 465 | 2017-08-15,49134 466 | 2017-08-16,50398 467 | 2017-08-17,55424 468 | 2017-08-18,51828 469 | 2017-08-19,41340 470 | 2017-08-20,45547 471 | 2017-08-21,61318 472 | 2017-08-22,54247 473 | 2017-08-23,54941 474 | 2017-08-24,38833 475 | 2017-08-25,37208 476 | 2017-08-26,39073 477 | 2017-08-27,40359 478 | 2017-08-28,55006 479 | 2017-08-29,52121 480 | 2017-08-30,48375 481 | 2017-08-31,47794 482 | 2017-09-01,47939 483 | 2017-09-02,40430 484 | 2017-09-03,28497 485 | 2017-09-04,51281 486 | 2017-09-05,52076 487 | 2017-09-06,53952 488 | 2017-09-07,54945 489 | 2017-09-08,48839 490 | 2017-09-09,44404 491 | 2017-09-10,48150 492 | 2017-09-11,56383 493 | 2017-09-12,52978 494 | 2017-09-13,52552 495 | 2017-09-14,52044 496 | 2017-09-15,50138 497 | 2017-09-16,42710 498 | 2017-09-17,42071 499 | 2017-09-18,58878 500 | 2017-09-19,51861 501 | 2017-09-20,51792 502 | 2017-09-21,48664 503 | 2017-09-22,43914 504 | 2017-09-23,39859 505 | 2017-09-24,37368 506 | 2017-09-25,46807 507 | 2017-09-26,50268 508 | 2017-09-27,48480 509 | 2017-09-28,45651 510 | 2017-09-29,43654 511 | 2017-09-30,34719 512 | 2017-10-01,38835 513 | 2017-10-02,46391 514 | 2017-10-03,50398 515 | 2017-10-04,50115 516 | 2017-10-05,57123 517 | 2017-10-06,50828 518 | 2017-10-07,40829 519 | 2017-10-08,39843 520 | 2017-10-09,48588 521 | 2017-10-10,50863 522 | 2017-10-11,46741 523 | 2017-10-12,51448 524 | 2017-10-13,50295 525 | 2017-10-14,42956 526 | 2017-10-15,39388 527 | 2017-10-16,48393 528 | 2017-10-17,52093 529 | 2017-10-18,50482 530 | 2017-10-19,56418 531 | 2017-10-20,44474 532 | 2017-10-21,42741 533 | 2017-10-22,46446 534 | 2017-10-23,50884 535 | 2017-10-24,55085 536 | 2017-10-25,50914 537 | 2017-10-26,48182 538 | 2017-10-27,46141 539 | 2017-10-28,39823 540 | 2017-10-29,39452 541 | 2017-10-30,48468 542 | 2017-10-31,45963 543 | 2017-11-01,45771 544 | 2017-11-02,54769 545 | 2017-11-03,54387 546 | 2017-11-04,43141 547 | 2017-11-05,43411 548 | 2017-11-06,55505 549 | 2017-11-07,55343 550 | 2017-11-08,49695 551 | 2017-11-09,56215 552 | 2017-11-10,59465 553 | 2017-11-11,41105 554 | 2017-11-12,53562 555 | 2017-11-13,56598 556 | 2017-11-14,58650 557 | 2017-11-15,57976 558 | 2017-11-16,61562 559 | 2017-11-17,54098 560 | 2017-11-18,45065 561 | 2017-11-19,48547 562 | 2017-11-20,55367 563 | 2017-11-21,56693 564 | 2017-11-22,136744 565 | 2017-11-23,113149 566 | 2017-11-24,59697 567 | 2017-11-25,42161 568 | 2017-11-26,45100 569 | 2017-11-27,55855 570 | 2017-11-28,54324 571 | 2017-11-29,56843 572 | 2017-11-30,60249 573 | 2017-12-01,58830 574 | 2017-12-02,34791 575 | 2017-12-03,34841 576 | 2017-12-04,52880 577 | 2017-12-05,60788 578 | 2017-12-06,60358 579 | 2017-12-07,55929 580 | 2017-12-08,44714 581 | 2017-12-09,41348 582 | 2017-12-10,40424 583 | 2017-12-11,53151 584 | 2017-12-12,51780 585 | 2017-12-13,57092 586 | 2017-12-14,48394 587 | 2017-12-15,46097 588 | 2017-12-16,48136 589 | 2017-12-17,37655 590 | 2017-12-18,49015 591 | 2017-12-19,55850 592 | 2017-12-20,48414 593 | 2017-12-21,51137 594 | 2017-12-22,45127 595 | 2017-12-23,34257 596 | 2017-12-24,36708 597 | 2017-12-25,49542 598 | 2017-12-26,44083 599 | 2017-12-27,43075 600 | 2017-12-28,51018 601 | 2017-12-29,72819 602 | 2017-12-30,50169 603 | 2017-12-31,42616 604 | 2018-01-01,41810 605 | 2018-01-02,51362 606 | 2018-01-03,56013 607 | 2018-01-04,58910 608 | 2018-01-05,58239 609 | 2018-01-06,41870 610 | 2018-01-07,42981 611 | 2018-01-08,62887 612 | 2018-01-09,60260 613 | 2018-01-10,106349 614 | 2018-01-11,77030 615 | 2018-01-12,53781 616 | 2018-01-13,42621 617 | 2018-01-14,43990 618 | 2018-01-15,59119 619 | 2018-01-16,63272 620 | 2018-01-17,60159 621 | 2018-01-18,64068 622 | 2018-01-19,61345 623 | 2018-01-20,50553 624 | 2018-01-21,46436 625 | 2018-01-22,63084 626 | 2018-01-23,62758 627 | 2018-01-24,61700 628 | 2018-01-25,65438 629 | 2018-01-26,56792 630 | 2018-01-27,48186 631 | 2018-01-28,49485 632 | 2018-01-29,66609 633 | 2018-01-30,77144 634 | 2018-01-31,61732 635 | 2018-02-01,65803 636 | 2018-02-02,59272 637 | 2018-02-03,45779 638 | 2018-02-04,29872 639 | 2018-02-05,76073 640 | 2018-02-06,77059 641 | 2018-02-07,74939 642 | 2018-02-08,75397 643 | 2018-02-09,71514 644 | 2018-02-10,51208 645 | 2018-02-11,52371 646 | 2018-02-12,76738 647 | 2018-02-13,74967 648 | 2018-02-14,66850 649 | 2018-02-15,70090 650 | 2018-02-16,68310 651 | 2018-02-17,56257 652 | 2018-02-18,53798 653 | 2018-02-19,67406 654 | 2018-02-20,72493 655 | 2018-02-21,82716 656 | 2018-02-22,84685 657 | 2018-02-23,68160 658 | 2018-02-24,51002 659 | 2018-02-25,50945 660 | 2018-02-26,69180 661 | 2018-02-27,75783 662 | 2018-02-28,70345 663 | 2018-03-01,66423 664 | 2018-03-02,62627 665 | 2018-03-03,48492 666 | 2018-03-04,53712 667 | 2018-03-05,65506 668 | 2018-03-06,88644 669 | 2018-03-07,76008 670 | 2018-03-08,67376 671 | 2018-03-09,63935 672 | 2018-03-10,52913 673 | 2018-03-11,49759 674 | 2018-03-12,66045 675 | 2018-03-13,70428 676 | 2018-03-14,66001 677 | 2018-03-15,66800 678 | 2018-03-16,60562 679 | 2018-03-17,48609 680 | 2018-03-18,48808 681 | 2018-03-19,64044 682 | 2018-03-20,65209 683 | 2018-03-21,68532 684 | 2018-03-22,71059 685 | 2018-03-23,65798 686 | 2018-03-24,48873 687 | 2018-03-25,51219 688 | 2018-03-26,68186 689 | 2018-03-27,70345 690 | 2018-03-28,68748 691 | 2018-03-29,68853 692 | 2018-03-30,58890 693 | 2018-03-31,51103 694 | 2018-04-01,56224 695 | 2018-04-02,66957 696 | 2018-04-03,70500 697 | 2018-04-04,71217 698 | 2018-04-05,71640 699 | 2018-04-06,65494 700 | 2018-04-07,52642 701 | 2018-04-08,49394 702 | 2018-04-09,67122 703 | 2018-04-10,67930 704 | 2018-04-11,66601 705 | 2018-04-12,88232 706 | 2018-04-13,65620 707 | 2018-04-14,46493 708 | 2018-04-15,50303 709 | 2018-04-16,70225 710 | 2018-04-17,70814 711 | 2018-04-18,67661 712 | 2018-04-19,65526 713 | 2018-04-20,68599 714 | 2018-04-21,53931 715 | 2018-04-22,53319 716 | 2018-04-23,68490 717 | 2018-04-24,68477 718 | 2018-04-25,68962 719 | 2018-04-26,64760 720 | 2018-04-27,56276 721 | 2018-04-28,42883 722 | 2018-04-29,42861 723 | 2018-04-30,51372 724 | 2018-05-01,56905 725 | 2018-05-02,56834 726 | 2018-05-03,64835 727 | 2018-05-04,56420 728 | 2018-05-05,44898 729 | 2018-05-06,43602 730 | 2018-05-07,55713 731 | 2018-05-08,57836 732 | 2018-05-09,54817 733 | 2018-05-10,65517 734 | 2018-05-11,59600 735 | 2018-05-12,40878 736 | 2018-05-13,46586 737 | 2018-05-14,55193 738 | 2018-05-15,59453 739 | 2018-05-16,56362 740 | 2018-05-17,58871 741 | 2018-05-18,59496 742 | 2018-05-19,44562 743 | 2018-05-20,48197 744 | 2018-05-21,57575 745 | 2018-05-22,59419 746 | 2018-05-23,63881 747 | 2018-05-24,72924 748 | 2018-05-25,49617 749 | 2018-05-26,42533 750 | 2018-05-27,43357 751 | 2018-05-28,53397 752 | 2018-05-29,58201 753 | 2018-05-30,69592 754 | 2018-05-31,96378 755 | 2018-06-01,72946 756 | 2018-06-02,58104 757 | 2018-06-03,56734 758 | 2018-06-04,74785 759 | 2018-06-05,130604 760 | 2018-06-06,70775 761 | 2018-06-07,69192 762 | 2018-06-08,64313 763 | 2018-06-09,56129 764 | 2018-06-10,60222 765 | 2018-06-11,71665 766 | 2018-06-12,72167 767 | 2018-06-13,70514 768 | 2018-06-14,68685 769 | 2018-06-15,58703 770 | 2018-06-16,50098 771 | 2018-06-17,52736 772 | 2018-06-18,80955 773 | 2018-06-19,77413 774 | 2018-06-20,83183 775 | 2018-06-21,81671 776 | 2018-06-22,66745 777 | 2018-06-23,72015 778 | 2018-06-24,68024 779 | 2018-06-25,80403 780 | 2018-06-26,81573 781 | 2018-06-27,69363 782 | 2018-06-28,63678 783 | 2018-06-29,66111 784 | 2018-06-30,54004 785 | 2018-07-01,44552 786 | 2018-07-02,61693 787 | 2018-07-03,65394 788 | 2018-07-04,63630 789 | 2018-07-05,74420 790 | 2018-07-06,62313 791 | 2018-07-07,54111 792 | 2018-07-08,51703 793 | 2018-07-09,62304 794 | 2018-07-10,90831 795 | 2018-07-11,71342 796 | 2018-07-12,64328 797 | 2018-07-13,60919 798 | 2018-07-14,49131 799 | 2018-07-15,50575 800 | 2018-07-16,63715 801 | 2018-07-17,71926 802 | 2018-07-18,65871 803 | 2018-07-19,63196 804 | 2018-07-20,64881 805 | 2018-07-21,54481 806 | 2018-07-22,54784 807 | 2018-07-23,70218 808 | 2018-07-24,73937 809 | 2018-07-25,95611 810 | 2018-07-26,96264 811 | 2018-07-27,57272 812 | 2018-07-28,44523 813 | 2018-07-29,44070 814 | 2018-07-30,60989 815 | 2018-07-31,62339 816 | 2018-08-01,63520 817 | 2018-08-02,63268 818 | 2018-08-03,62227 819 | 2018-08-04,46947 820 | 2018-08-05,42650 821 | 2018-08-06,63159 822 | 2018-08-07,67216 823 | 2018-08-08,72890 824 | 2018-08-09,71460 825 | 2018-08-10,71279 826 | 2018-08-11,55241 827 | 2018-08-12,52774 828 | 2018-08-13,66145 829 | 2018-08-14,66222 830 | 2018-08-15,67895 831 | 2018-08-16,61577 832 | 2018-08-17,59822 833 | 2018-08-18,52645 834 | 2018-08-19,58069 835 | 2018-08-20,71289 836 | 2018-08-21,68729 837 | 2018-08-22,67580 838 | 2018-08-23,66574 839 | 2018-08-24,62847 840 | 2018-08-25,51910 841 | 2018-08-26,49398 842 | 2018-08-27,63821 843 | 2018-08-28,63969 844 | 2018-08-29,63573 845 | 2018-08-30,75250 846 | 2018-08-31,77834 847 | 2018-09-01,47114 848 | 2018-09-02,46875 849 | 2018-09-03,67138 850 | 2018-09-04,72182 851 | 2018-09-05,76418 852 | 2018-09-06,79476 853 | 2018-09-07,78279 854 | 2018-09-08,72950 855 | 2018-09-09,56988 856 | 2018-09-10,79179 857 | 2018-09-11,88013 858 | 2018-09-12,73528 859 | 2018-09-13,77145 860 | 2018-09-14,66614 861 | 2018-09-15,56505 862 | 2018-09-16,50128 863 | 2018-09-17,64325 864 | 2018-09-18,68692 865 | 2018-09-19,71498 866 | 2018-09-20,68598 867 | 2018-09-21,68987 868 | 2018-09-22,50512 869 | 2018-09-23,56152 870 | 2018-09-24,70468 871 | 2018-09-25,64054 872 | 2018-09-26,69501 873 | 2018-09-27,67876 874 | 2018-09-28,72233 875 | 2018-09-29,52292 876 | 2018-09-30,44532 877 | 2018-10-01,25830 878 | 2018-10-02,10099 879 | 2018-10-03,62166 880 | 2018-10-04,83869 881 | 2018-10-05,86759 882 | 2018-10-06,59515 883 | 2018-10-07,87863 884 | 2018-10-08,120741 885 | 2018-10-09,131815 886 | 2018-10-10,153341 887 | 2018-10-11,163758 888 | 2018-10-12,176175 889 | 2018-10-13,168644 890 | 2018-10-14,184018 891 | 2018-10-15,174639 892 | 2018-10-16,177647 893 | 2018-10-17,169915 894 | 2018-10-18,155078 895 | 2018-10-19,149940 896 | 2018-10-20,92549 897 | 2018-10-21,80661 898 | 2018-10-22,80458 899 | 2018-10-23,105987 900 | 2018-10-24,138476 901 | 2018-10-25,140264 902 | 2018-10-26,100213 903 | 2018-10-27,65391 904 | 2018-10-28,61406 905 | 2018-10-29,76625 906 | 2018-10-30,97815 907 | 2018-10-31,108695 908 | 2018-11-01,85861 909 | 2018-11-02,73794 910 | 2018-11-03,62830 911 | 2018-11-04,62538 912 | 2018-11-05,79117 913 | 2018-11-06,83775 914 | 2018-11-07,84770 915 | 2018-11-08,105849 916 | 2018-11-09,76395 917 | 2018-11-10,64975 918 | 2018-11-11,58481 919 | 2018-11-12,80567 920 | 2018-11-13,91368 921 | 2018-11-14,90488 922 | 2018-11-15,76911 923 | 2018-11-16,80870 924 | 2018-11-17,61170 925 | 2018-11-18,66269 926 | 2018-11-19,92083 927 | 2018-11-20,90130 928 | 2018-11-21,77632 929 | 2018-11-22,78076 930 | 2018-11-23,75398 931 | 2018-11-24,64116 932 | 2018-11-25,62559 933 | 2018-11-26,77084 934 | 2018-11-27,93864 935 | 2018-11-28,88667 936 | 2018-11-29,92368 937 | 2018-11-30,82645 938 | 2018-12-01,62373 939 | 2018-12-02,73710 940 | 2018-12-03,96254 941 | 2018-12-04,96984 942 | 2018-12-05,96559 943 | 2018-12-06,89751 944 | 2018-12-07,86705 945 | 2018-12-08,72606 946 | 2018-12-09,70190 947 | 2018-12-10,74469 948 | 2018-12-11,81153 949 | 2018-12-12,83163 950 | 2018-12-13,89445 951 | 2018-12-14,83384 952 | 2018-12-15,79467 953 | 2018-12-16,77869 954 | 2018-12-17,98436 955 | 2018-12-18,96231 956 | 2018-12-19,92070 957 | 2018-12-20,90449 958 | 2018-12-21,85083 959 | 2018-12-22,70392 960 | 2018-12-23,69765 961 | 2018-12-24,69618 962 | 2018-12-25,74671 963 | 2018-12-26,76754 964 | 2018-12-27,80703 965 | 2018-12-28,73629 966 | 2018-12-29,66282 967 | 2018-12-30,62826 968 | 2018-12-31,60481 969 | 2019-01-01,58508 970 | 2019-01-02,109708 971 | 2019-01-03,100710 972 | 2019-01-04,94514 973 | 2019-01-05,77897 974 | 2019-01-06,94108 975 | 2019-01-07,94715 976 | 2019-01-08,105928 977 | 2019-01-09,106576 978 | 2019-01-10,111328 979 | 2019-01-11,120991 980 | 2019-01-12,110775 981 | 2019-01-13,97243 982 | 2019-01-14,114139 983 | 2019-01-15,112172 984 | 2019-01-16,113433 985 | 2019-01-17,105912 986 | 2019-01-18,106513 987 | 2019-01-19,79858 988 | 2019-01-20,78679 989 | 2019-01-21,103240 990 | 2019-01-22,106126 991 | 2019-01-23,119710 992 | 2019-01-24,114541 993 | 2019-01-25,119836 994 | 2019-01-26,78342 995 | 2019-01-27,86596 996 | 2019-01-28,111784 997 | 2019-01-29,107881 998 | 2019-01-30,106844 999 | 2019-01-31,115145 1000 | 2019-02-01,99156 1001 | 2019-02-02,71654 1002 | 2019-02-03,104287 1003 | 2019-02-04,97713 1004 | 2019-02-05,107855 1005 | 2019-02-06,120854 1006 | 2019-02-07,107973 1007 | 2019-02-08,101730 1008 | 2019-02-09,118356 1009 | 2019-02-10,78137 1010 | 2019-02-11,113240 1011 | 2019-02-12,118410 1012 | 2019-02-13,122283 1013 | 2019-02-14,134772 1014 | 2019-02-15,123318 1015 | 2019-02-16,111750 1016 | 2019-02-17,98067 1017 | 2019-02-18,112632 1018 | 2019-02-19,106237 1019 | 2019-02-20,120747 1020 | 2019-02-21,114251 1021 | 2019-02-22,102341 1022 | 2019-02-23,86657 1023 | 2019-02-24,81696 1024 | 2019-02-25,99292 1025 | 2019-02-26,108135 1026 | 2019-02-27,102492 1027 | 2019-02-28,103079 1028 | 2019-03-01,92662 1029 | 2019-03-02,75072 1030 | 2019-03-03,76810 1031 | 2019-03-04,104991 1032 | 2019-03-05,113300 1033 | 2019-03-06,99434 1034 | 2019-03-07,96024 1035 | 2019-03-08,91932 1036 | 2019-03-09,65607 1037 | 2019-03-10,68218 1038 | 2019-03-11,100407 1039 | 2019-03-12,92674 1040 | 2019-03-13,97029 1041 | 2019-03-14,107248 1042 | 2019-03-15,102519 1043 | 2019-03-16,80095 1044 | 2019-03-17,66368 1045 | 2019-03-18,101569 1046 | 2019-03-19,98515 1047 | 2019-03-20,95566 1048 | 2019-03-21,83454 1049 | 2019-03-22,92856 1050 | 2019-03-23,59222 1051 | 2019-03-24,64835 1052 | 2019-03-25,94751 1053 | 2019-03-26,106366 1054 | 2019-03-27,97418 1055 | 2019-03-28,113353 1056 | 2019-03-29,134753 1057 | 2019-03-30,83480 1058 | 2019-03-31,71121 1059 | 2019-04-01,98719 1060 | 2019-04-02,93282 1061 | 2019-04-03,98107 1062 | 2019-04-04,112045 1063 | 2019-04-05,110418 1064 | 2019-04-06,80815 1065 | 2019-04-07,64028 1066 | 2019-04-08,89370 1067 | 2019-04-09,92505 1068 | 2019-04-10,92153 1069 | 2019-04-11,97584 1070 | 2019-04-12,92058 1071 | 2019-04-13,93224 1072 | 2019-04-14,75554 1073 | 2019-04-15,92015 1074 | 2019-04-16,98066 1075 | 2019-04-17,100099 1076 | 2019-04-18,86821 1077 | 2019-04-19,73030 1078 | 2019-04-20,131100 1079 | 2019-04-21,75644 1080 | 2019-04-22,81984 1081 | 2019-04-23,97791 1082 | 2019-04-24,91681 1083 | 2019-04-25,87451 1084 | 2019-04-26,79416 1085 | 2019-04-27,61038 1086 | 2019-04-28,57724 1087 | 2019-04-29,80832 1088 | 2019-04-30,96499 1089 | 2019-05-01,91566 1090 | 2019-05-02,105923 1091 | 2019-05-03,100673 1092 | 2019-05-04,62282 1093 | 2019-05-05,86542 1094 | 2019-05-06,83274 1095 | 2019-05-07,85039 1096 | 2019-05-08,92181 1097 | 2019-05-09,91506 1098 | 2019-05-10,86823 1099 | 2019-05-11,89641 1100 | 2019-05-12,65338 1101 | 2019-05-13,90475 1102 | 2019-05-14,106162 1103 | 2019-05-15,104193 1104 | 2019-05-16,94579 1105 | 2019-05-17,101725 1106 | 2019-05-18,86865 1107 | 2019-05-19,101164 1108 | 2019-05-20,92125 1109 | 2019-05-21,93848 1110 | 2019-05-22,106702 1111 | 2019-05-23,86054 1112 | 2019-05-24,83585 1113 | 2019-05-25,67210 1114 | 2019-05-26,67965 1115 | 2019-05-27,106559 1116 | 2019-05-28,99094 1117 | 2019-05-29,100021 1118 | 2019-05-30,102705 1119 | 2019-05-31,102818 1120 | 2019-06-01,71713 1121 | 2019-06-02,80399 1122 | 2019-06-03,102453 1123 | 2019-06-04,106321 1124 | 2019-06-05,102191 1125 | 2019-06-06,106048 1126 | 2019-06-07,104623 1127 | 2019-06-08,61504 1128 | 2019-06-09,75791 1129 | 2019-06-10,98910 1130 | 2019-06-11,102190 1131 | 2019-06-12,107613 1132 | 2019-06-13,99938 1133 | 2019-06-14,81671 1134 | 2019-06-15,63355 1135 | 2019-06-16,69442 1136 | 2019-06-17,1173655 1137 | 2019-06-18,1166225 1138 | 2019-06-19,102231 1139 | 2019-06-20,105359 1140 | 2019-06-21,101275 1141 | 2019-06-22,72492 1142 | 2019-06-23,83188 1143 | 2019-06-24,107207 1144 | 2019-06-25,107039 1145 | 2019-06-26,95900 1146 | 2019-06-27,107290 1147 | 2019-06-28,87190 1148 | 2019-06-29,63622 1149 | 2019-06-30,65243 1150 | 2019-07-01,97699 1151 | 2019-07-02,97183 1152 | 2019-07-03,91528 1153 | 2019-07-04,87225 1154 | 2019-07-05,131213 1155 | 2019-07-06,66995 1156 | 2019-07-07,71811 1157 | 2019-07-08,97352 1158 | 2019-07-09,117078 1159 | 2019-07-10,207841 1160 | 2019-07-11,111793 1161 | 2019-07-12,112038 1162 | 2019-07-13,70150 1163 | 2019-07-14,68169 1164 | 2019-07-15,107960 1165 | 2019-07-16,107007 1166 | 2019-07-17,129677 1167 | 2019-07-18,127187 1168 | 2019-07-19,102631 1169 | 2019-07-20,75436 1170 | 2019-07-21,70848 1171 | 2019-07-22,107960 1172 | 2019-07-23,110464 1173 | 2019-07-24,121716 1174 | 2019-07-25,100948 1175 | 2019-07-26,91195 1176 | 2019-07-27,68741 1177 | 2019-07-28,70696 1178 | 2019-07-29,100947 1179 | 2019-07-30,104442 1180 | 2019-07-31,99008 1181 | 2019-08-01,103424 1182 | 2019-08-02,93270 1183 | 2019-08-03,151671 1184 | 2019-08-04,145731 1185 | 2019-08-05,105386 1186 | 2019-08-06,337325 1187 | 2019-08-07,341595 1188 | 2019-08-08,99495 1189 | 2019-08-09,93534 1190 | 2019-08-10,65534 1191 | 2019-08-11,62891 1192 | 2019-08-12,87424 1193 | 2019-08-13,100304 1194 | 2019-08-14,105699 1195 | 2019-08-15,85475 1196 | 2019-08-16,96934 1197 | 2019-08-17,55069 1198 | 2019-08-18,84197 1199 | 2019-08-19,119860 1200 | 2019-08-20,114539 1201 | 2019-08-21,118384 1202 | 2019-08-22,140928 1203 | 2019-08-23,103203 1204 | 2019-08-24,80988 1205 | 2019-08-25,80635 1206 | 2019-08-26,130151 1207 | 2019-08-27,122564 1208 | 2019-08-28,116142 1209 | 2019-08-29,94855 1210 | 2019-08-30,98117 1211 | 2019-08-31,122398 1212 | 2019-09-01,69977 1213 | 2019-09-02,85331 1214 | 2019-09-03,102896 1215 | 2019-09-04,106868 1216 | 2019-09-05,102307 1217 | 2019-09-06,91461 1218 | 2019-09-07,61628 1219 | 2019-09-08,98955 1220 | 2019-09-09,174212 1221 | 2019-09-10,95371 1222 | 2019-09-11,97140 1223 | 2019-09-12,101739 1224 | 2019-09-13,91749 1225 | 2019-09-14,65897 1226 | 2019-09-15,66924 1227 | 2019-09-16,93719 1228 | 2019-09-17,116171 1229 | 2019-09-18,106662 1230 | 2019-09-19,106773 1231 | 2019-09-20,91165 1232 | 2019-09-21,61998 1233 | 2019-09-22,63127 1234 | 2019-09-23,105193 1235 | 2019-09-24,106773 1236 | 2019-09-25,130091 1237 | 2019-09-26,146917 1238 | 2019-09-27,105245 1239 | 2019-09-28,71045 1240 | 2019-09-29,93493 1241 | 2019-09-30,107238 1242 | 2019-10-01,107202 1243 | 2019-10-02,99416 1244 | 2019-10-03,98737 1245 | 2019-10-04,91873 1246 | 2019-10-05,78400 1247 | 2019-10-06,76252 1248 | 2019-10-07,114746 1249 | 2019-10-08,121411 1250 | 2019-10-09,121069 1251 | 2019-10-10,129971 1252 | 2019-10-11,157475 1253 | 2019-10-12,147056 1254 | 2019-10-13,116148 1255 | 2019-10-14,118108 1256 | 2019-10-15,131170 1257 | 2019-10-16,185784 1258 | 2019-10-17,169663 1259 | 2019-10-18,160650 1260 | 2019-10-19,116900 1261 | 2019-10-20,120460 1262 | 2019-10-21,208036 1263 | 2019-10-22,229870 1264 | 2019-10-23,273708 1265 | 2019-10-24,255178 1266 | 2019-10-25,176921 1267 | 2019-10-26,118564 1268 | 2019-10-27,129458 1269 | 2019-10-28,209661 1270 | 2019-10-29,211967 1271 | 2019-10-30,210925 1272 | 2019-10-31,189965 1273 | 2019-11-01,168513 1274 | 2019-11-02,118347 1275 | 2019-11-03,130118 1276 | 2019-11-04,201791 1277 | 2019-11-05,208234 1278 | 2019-11-06,194616 1279 | 2019-11-07,200462 1280 | 2019-11-08,177588 1281 | 2019-11-09,115642 1282 | 2019-11-10,117717 1283 | 2019-11-11,212058 1284 | 2019-11-12,206488 1285 | 2019-11-13,195023 1286 | 2019-11-14,196477 1287 | 2019-11-15,314101 1288 | 2019-11-16,125634 1289 | 2019-11-17,131639 1290 | 2019-11-18,221181 1291 | 2019-11-19,221555 1292 | 2019-11-20,151733 1293 | 2019-11-21,169121 1294 | 2019-11-22,204015 1295 | 2019-11-23,146658 1296 | 2019-11-24,138875 1297 | 2019-11-25,219608 1298 | 2019-11-26,220590 1299 | 2019-11-27,208223 1300 | 2019-11-28,202049 1301 | 2019-11-29,171584 1302 | 2019-11-30,141161 1303 | 2019-12-01,142918 1304 | 2019-12-02,220144 1305 | 2019-12-03,158549 1306 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | # This entrypoint file to be used in development. Start by reading README.md 2 | import time_series_visualizer 3 | from unittest import main 4 | 5 | # Test your function by calling it here 6 | time_series_visualizer.draw_line_plot() 7 | time_series_visualizer.draw_bar_plot() 8 | time_series_visualizer.draw_box_plot() 9 | 10 | # Run unit tests automatically 11 | main(module='test_module', exit=False) -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | seaborn==0.9.0 2 | pandas==1.5.3 3 | -------------------------------------------------------------------------------- /test_module.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import time_series_visualizer 3 | import matplotlib as mpl 4 | 5 | class DataCleaningTestCase(unittest.TestCase): 6 | def test_data_cleaning(self): 7 | actual = int(time_series_visualizer.df.count(numeric_only=True)) 8 | expected = 1238 9 | self.assertEqual(actual, expected, "Expected DataFrame count after cleaning to be 1238.") 10 | 11 | class LinePlotTestCase(unittest.TestCase): 12 | def setUp(self): 13 | self.fig = time_series_visualizer.draw_line_plot() 14 | self.ax = self.fig.axes[0] 15 | 16 | def test_line_plot_title(self): 17 | actual = self.ax.get_title() 18 | expected = "Daily freeCodeCamp Forum Page Views 5/2016-12/2019" 19 | self.assertEqual(actual, expected, "Expected line plot title to be 'Daily freeCodeCamp Forum Page Views 5/2016-12/2019'") 20 | 21 | def test_line_plot_labels(self): 22 | actual = self.ax.get_xlabel() 23 | expected = "Date" 24 | self.assertEqual(actual, expected, "Expected line plot xlabel to be 'Date'") 25 | actual = self.ax.get_ylabel() 26 | expected = "Page Views" 27 | self.assertEqual(actual, expected, "Expected line plot ylabel to be 'Page Views'") 28 | 29 | def test_line_plot_data_quantity(self): 30 | actual = len(self.ax.lines[0].get_ydata()) 31 | expected = 1238 32 | self.assertEqual(actual, expected, "Expected number of data points in line plot to be 1238.") 33 | 34 | 35 | class BarPlotTestCase(unittest.TestCase): 36 | def setUp(self): 37 | self.fig = time_series_visualizer.draw_bar_plot() 38 | self.ax = self.fig.axes[0] 39 | 40 | def test_bar_plot_legend_labels(self): 41 | actual = [] 42 | for label in self.ax.get_legend().get_texts(): 43 | actual.append(label.get_text()) 44 | expected = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] 45 | self.assertEqual(actual, expected, "Expected bar plot legend labels to be months of the year.") 46 | 47 | def test_bar_plot_labels(self): 48 | actual = self.ax.get_xlabel() 49 | expected = "Years" 50 | self.assertEqual(actual, expected, "Expected bar plot xlabel to be 'Years'") 51 | actual = self.ax.get_ylabel() 52 | expected = "Average Page Views" 53 | self.assertEqual(actual, expected, "Expected bar plot ylabel to be 'Average Page Views'") 54 | actual = [] 55 | for label in self.ax.get_xaxis().get_majorticklabels(): 56 | actual.append(label.get_text()) 57 | expected = ['2016', '2017', '2018', '2019'] 58 | self.assertEqual(actual, expected, "Expected bar plot secondary labels to be '2016', '2017', '2018', '2019'") 59 | 60 | def test_bar_plot_number_of_bars(self): 61 | actual = len([rect for rect in self.ax.get_children() if isinstance(rect, mpl.patches.Rectangle)]) 62 | expected = 49 63 | self.assertEqual(actual, expected, "Expected a different number of bars in bar chart.") 64 | 65 | 66 | class BoxPlotTestCase(unittest.TestCase): 67 | def setUp(self): 68 | self.fig = time_series_visualizer.draw_box_plot() 69 | self.ax1 = self.fig.axes[0] 70 | self.ax2 = self.fig.axes[1] 71 | 72 | def test_box_plot_number(self): 73 | actual = len(self.fig.get_axes()) 74 | expected = 2 75 | self.assertEqual(actual, expected, "Expected two box plots in figure.") 76 | 77 | def test_box_plot_labels(self): 78 | actual = self.ax1.get_xlabel() 79 | expected = "Year" 80 | self.assertEqual(actual, expected, "Expected box plot 1 xlabel to be 'Year'") 81 | actual = self.ax1.get_ylabel() 82 | expected = "Page Views" 83 | self.assertEqual(actual, expected, "Expected box plot 1 ylabel to be 'Page Views'") 84 | actual = self.ax2.get_xlabel() 85 | expected = "Month" 86 | self.assertEqual(actual, expected, "Expected box plot 2 xlabel to be 'Month'") 87 | actual = self.ax2.get_ylabel() 88 | expected = "Page Views" 89 | self.assertEqual(actual, expected, "Expected box plot 2 ylabel to be 'Page Views'") 90 | actual = [] 91 | for label in self.ax1.get_xaxis().get_majorticklabels(): 92 | actual.append(label.get_text()) 93 | expected = ['2016', '2017', '2018', '2019'] 94 | self.assertEqual(actual, expected, "Expected box plot 1 secondary labels to be '2016', '2017', '2018', '2019'") 95 | actual = [] 96 | for label in self.ax2.get_xaxis().get_majorticklabels(): 97 | actual.append(label.get_text()) 98 | expected = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] 99 | self.assertEqual(actual, expected, "Expected box plot 2 secondary labels to be 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'") 100 | actual = [] 101 | for label in self.ax1.get_yaxis().get_majorticklabels(): 102 | actual.append(label.get_text()) 103 | expected = ['0', '20000', '40000', '60000', '80000', '100000', '120000', '140000', '160000', '180000', '200000'] 104 | self.assertEqual(actual, expected, "Expected box plot 1 secondary labels to be '0', '20000', '40000', '60000', '80000', '100000', '120000', '140000', '160000', '180000', '200000'") 105 | 106 | def test_box_plot_titles(self): 107 | actual = self.ax1.get_title() 108 | expected = "Year-wise Box Plot (Trend)" 109 | self.assertEqual(actual, expected, "Expected box plot 1 title to be 'Year-wise Box Plot (Trend)'") 110 | actual = self.ax2.get_title() 111 | expected = "Month-wise Box Plot (Seasonality)" 112 | self.assertEqual(actual, expected, "Expected box plot 2 title to be 'Month-wise Box Plot (Seasonality)'") 113 | 114 | def test_box_plot_number_of_boxes(self): 115 | actual = len(self.ax1.lines) / 6 # Every box has 6 lines 116 | expected = 4 117 | self.assertEqual(actual, expected, "Expected four boxes in box plot 1") 118 | actual = len(self.ax2.lines) / 6 # Every box has 6 lines 119 | expected = 12 120 | self.assertEqual(actual, expected, "Expected 12 boxes in box plot 2") 121 | 122 | if __name__ == "__main__": 123 | unittest.main() 124 | -------------------------------------------------------------------------------- /time_series_visualizer.py: -------------------------------------------------------------------------------- 1 | import matplotlib.pyplot as plt 2 | import pandas as pd 3 | import seaborn as sns 4 | from pandas.plotting import register_matplotlib_converters 5 | register_matplotlib_converters() 6 | 7 | # Import data (Make sure to parse dates. Consider setting index column to 'date'.) 8 | df = None 9 | 10 | # Clean data 11 | df = None 12 | 13 | 14 | def draw_line_plot(): 15 | # Draw line plot 16 | 17 | 18 | 19 | 20 | 21 | # Save image and return fig (don't change this part) 22 | fig.savefig('line_plot.png') 23 | return fig 24 | 25 | def draw_bar_plot(): 26 | # Copy and modify data for monthly bar plot 27 | df_bar = None 28 | 29 | # Draw bar plot 30 | 31 | 32 | 33 | 34 | 35 | # Save image and return fig (don't change this part) 36 | fig.savefig('bar_plot.png') 37 | return fig 38 | 39 | def draw_box_plot(): 40 | # Prepare data for box plots (this part is done!) 41 | df_box = df.copy() 42 | df_box.reset_index(inplace=True) 43 | df_box['year'] = [d.year for d in df_box.date] 44 | df_box['month'] = [d.strftime('%b') for d in df_box.date] 45 | 46 | # Draw box plots (using Seaborn) 47 | 48 | 49 | 50 | 51 | 52 | # Save image and return fig (don't change this part) 53 | fig.savefig('box_plot.png') 54 | return fig 55 | --------------------------------------------------------------------------------