4. Examples¶
- 4.1. Basic usage
- 4.2. Write table(s) with a specific format
- 4.3. Configure output
- 4.4. Tabular Data Sources
- 4.5. Specify Cell Styles For Each Column
- 4.6. Specify theme
- 4.7. Using Multi-Byte Characters
- 4.8. Configure Type Hints
- 4.9. Jupyter Notebook Support
4.10. Multiprocessing¶
You can increase the number of workers to process table data via max_workers
attribute of a writer.
The more max_workers
the less processing time when tabular data is large and the execution environment has available cores.
If you increase max_workers
larger than one, recommend using main guarded as follows to avoid problems caused by multi-processing:
from multiprocessing import cpu_count
import pytablewriter as ptw
def main():
writer = ptw.MarkdownTableWriter()
writer.max_workers = cpu_count()
...
if __name__ == "__main__":
main()