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.

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

Uploaded Source

Built Distribution

drawdata-0.3.8-py3-none-any.whl (239.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: drawdata-0.3.8.tar.gz
  • Upload date:
  • Size: 238.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.7

File hashes

Hashes for drawdata-0.3.8.tar.gz
Algorithm Hash digest
SHA256 6f0974f0dd93accd98b3f85dc375e99d6a6ef231a0a0003a52989aa870046820
MD5 5ed7561faf589c8030771573b0468bae
BLAKE2b-256 0b622547efe193fd1540579cc2ef082bfe8dfa050c90034841d69eb96092c457

See more details on using hashes here.

File details

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

File metadata

  • Download URL: drawdata-0.3.8-py3-none-any.whl
  • Upload date:
  • Size: 239.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.7

File hashes

Hashes for drawdata-0.3.8-py3-none-any.whl
Algorithm Hash digest
SHA256 b6fa25a3c299b3925c7c4777fc6667c17c8859ffa17a18ba0fcb685a5abe4f63
MD5 3dfc15e7c97831dce4a045d816dbd9a1
BLAKE2b-256 9835f3acd14c970613c1a605a360037fc9deb8660532fe91f5be1b53c5814be0

See more details on using hashes here.

Supported by

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