Skip to main content

draw a dataset from inside Jupyter

Project description

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.

CleanShot 2025-05-08 at 17 27 36

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: 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

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.5.0.tar.gz (236.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

drawdata-0.5.0-py3-none-any.whl (237.6 kB view details)

Uploaded Python 3

File details

Details for the file drawdata-0.5.0.tar.gz.

File metadata

  • Download URL: drawdata-0.5.0.tar.gz
  • Upload date:
  • Size: 236.0 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for drawdata-0.5.0.tar.gz
Algorithm Hash digest
SHA256 5adba01509660fede7af34ae27016a5e0f555edbf7a4ef2af25a2276a076d2b7
MD5 0843b630cade73a643df3b8c0bf51e55
BLAKE2b-256 0ed7944b7a8e30e78882f2aeb606212e03599aa2152a75a921c8d4617a42dcb5

See more details on using hashes here.

File details

Details for the file drawdata-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: drawdata-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 237.6 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for drawdata-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 893031322cb254143efaa74d63a06b4dd447b6650d8c7917956a6d002ce7ce1c
MD5 117196bfdd4f64f567e3fc25bd1bf146
BLAKE2b-256 74dd8ec35d3f6186d3786eb4f36e6cf7800ffa0a0673feb7758828f2aac938b4

See more details on using hashes here.

Supported by

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