Skip to main content

Open in molab

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.

drawdata demo

The project uses anywidget under the hood so our tools should work in marimo, Jupyter, VSCode and Colab. You could use this to even 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: ScatterWidget

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

If you're eager to do scikit-learn stuff with your drawn data you may appreciate this property instead:

X, y = widget.data_as_X_y

The assumption for this property is that if you've used multiple colors that you're interested in doing classification and if you've only drawn one color you're interested in regression. In the case of regression y will refer to the y-axis.

Usage: BarWidget

from drawdata import BarWidget

widget = BarWidget(collection_names=["usage", "sunshine"], n_bins=24)
widget

CleanShot_2024-12-01_at_21 19 19

Release files for drawdata 0.5.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.5.2
File Size Uploaded
drawdata-0.5.2.tar.gz 236.4 kB Details

Built distribution (wheel)

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

Total release size: 474.5 kB

Release files / drawdata-0.5.2.tar.gz

Download URL drawdata-0.5.2.tar.gz
Size 236.4 kB
Tags Source
SHA-256 checksum
How to use checksums
11fb54a2a0b188e9c49bba344e019ea0d5f89752e2510031531035892e4fa455
BLAKE2b-256 checksum
How to use checksums
7316d82e593e387cb80a918957c3899687276706a217f69e68ed86a2568d454d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / drawdata-0.5.2-py3-none-any.whl

Download URL drawdata-0.5.2-py3-none-any.whl
Size 238.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e5045ed5d2128d7ef004aac9ff2195ba46d6e0711dd7adc663104f6b954eb1cf
BLAKE2b-256 checksum
How to use checksums
64dff57bbf49607c0f66fd69331efae41cbc24d3d878f53d3fb0fa2d4455ec51
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.5.2 This release

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

0.3.2

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