tqdm is a Python library for displaying progress bars while code processes iterables or performs other lengthy operations. It makes loops, downloads, and model-related workflows easier to monitor. section 5.0 section 5.1
Use tqdm to monitor:
- for loops over collections such as webpage or stock-ticker downloads section 5.1
- list and dictionary comprehensions that evaluate models or construct results section 5.1
- long-running data science tasks where completed iterations and elapsed time are useful signals section 5.0
Monitor downloads in a loop
Install the package with `pip install tqdm`, import it, and wrap the iterable passed to the loop: `from tqdm import tqdm\n\nfor ticker in tqdm(tickers):\n try:\n all_data[ticker] = si.get_data(ticker)\n except Exception:\n failures.append(ticker)`. The terminal or notebook displays progress, including completed iterations and elapsed time. section 5.1
Figure 5.1 This diagram shows three common problems you may encounter in your data science work, and the Python packages we can use to solve them. In the next few sections, we’ll explain what these packages do, and how to use them to monitor code progress and to auto-stop long-running code.
Use the workflow diagram to connect progress monitoring with other efficiency concerns, including automatic time-outs for long-running code. section 5.0
