Skip to content

Instantly share code, notes, and snippets.

View M-Anwar's full-sized avatar

Muhammed Anwar M-Anwar

  • University of Toronto
  • Toronto
View GitHub Profile
@M-Anwar
M-Anwar / threadPool.py
Created November 8, 2020 18:18
A quick way to distribute a python task with differing parameters across a thread pool.
import pandas as pd
import concurrent.futures
from tqdm import tqdm
def threadPoolCall(func, task_args, max_workers = 8, raise_exception=True, log_errors=True, show_progress=True, description=None):
""" Distributes out a task between a pool of worker threads and collects
the results. The task is a python function, and the arguments to the function
are specified in an array of tuple arguments, each element representing a
task.
@M-Anwar
M-Anwar / pandaViz.py
Last active May 18, 2019 00:30
Display Pandas Dataframe with Image Columns Inline within Jupyter Notebooks
from IPython.core import display as ICD
from IPython.display import HTML
from PIL import Image
from io import BytesIO
from IPython.display import HTML
import pandas as pd
import base64
###