Skip to main content

drawdata

"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

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

Usage

You can load the scatter widget to start drawing immediately.

from drawdata import ScatterWidget

widget = ScatterWidget()
widget

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
widget.data

# Get the drawn data as a dataframe
widget.data_as_pandas
widget.data_as_polars

Shoutout

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

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 
pd.read_clipboard(sep=",")

Metadata

Release files for drawdata 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for drawdata 0.3.2
File Size Uploaded
drawdata-0.3.2.tar.gz 119.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for drawdata 0.3.2
File Interpreter ABI Platform
drawdata-0.3.2-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 238.4 kB

Release files / drawdata-0.3.2.tar.gz

Download URL drawdata-0.3.2.tar.gz
Size 119.3 kB
Tags Source
SHA-256 checksum
How to use checksums
f1b6ba3b2c1e778993ca45ec58e943c16e8323e111d600a3107b5b7fb439c5eb
BLAKE2b-256 checksum
How to use checksums
37d0dd2536e4cc1c0e0131b41b234f7679220ac24d44f4e2c3be25127880b81e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.6

Release files / drawdata-0.3.2-py2.py3-none-any.whl

Download URL drawdata-0.3.2-py2.py3-none-any.whl
Size 119.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
76fd543c886f8256c72198a9dd8f2bc58e1e40503b9cac1e83abbff7069c1bf4
BLAKE2b-256 checksum
How to use checksums
acd855e7d877866f5fd01962ae4f496a360d3e2bd09004a9afbda262e17d3e84
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.6

Release history Release notifications | RSS feed

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.9

2 release files

0.3.8

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.5

3 release files

0.3.4

1 release file

0.3.3

2 release files

This release

0.3.2 This release

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page