Skip to main content

draw a dataset from inside Jupyter

Project description


"Just draw some data and get on with your day."

This small Python library contains Jupyter widgets that allow you to draw a dataset in a Jupyter notebook. This should be very useful when teaching machine learning algorithms.

The project uses anywidget under the hood so our tools should work in Jupyter, VSCode and Colab. That also means that you get a proper widget that can interact with ipywidgets natively. Here is an example where updating a drawing triggers a new scikit-learn model to train (code).

You can really get creative with this in a notebook, so feel free to give it a spin!


Installation occurs via pip.

python -m pip install drawdata

To read the data, polars is useful, but this library also suppots pandas:

python -m pip install pandas polars


You can load the scatter widget to start drawing immediately.

from drawdata import ScatterWidget

widget = ScatterWidget()

If you want to use the dataset that you've just drawn you can do so via:

# Get the drawn data as a list of dictionaries

# Get the drawn data as a dataframe


This project was originally part of my work over at calmcode labs but my employer probabl has been very supportive and has allowed me to work on this project during my working hours. This was super cool and I wanted to make sure I recognise them for it.

Old Features

The original implementation of our widget would use an iframe to load a site in order to be able to draw from a Jupyter notebook. This works, but requires more manual effort, only works with pandas via the clipboard feature and needs an internet connection. Here's what that widget looks like:

It will be kept around, but the way forward for this library is to build on top of anywidget.

Old Feature Usage

When you run this from jupyter, you should load in an iframe.

from drawdata import draw_scatter


Once you're done drawing you can copy the data to the clipboard. After this you can use pandas to read the clipboard to get your drawn data into a dataframe.

import pandas as pd 

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

drawdata-0.3.3.tar.gz (119.3 kB view hashes)

Uploaded Source

Built Distribution

drawdata-0.3.3-py2.py3-none-any.whl (119.1 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page