Skip to main content

draw a dataset from inside Jupyter

Project description

drawdata

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.

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 work 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=",")

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.1.tar.gz (118.7 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.3.1-py2.py3-none-any.whl (118.8 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: drawdata-0.3.1.tar.gz
  • Upload date:
  • Size: 118.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.6

File hashes

Hashes for drawdata-0.3.1.tar.gz
Algorithm Hash digest
SHA256 62fa603a29ed30e43b4d09b496aeb401728a1657492fdb05bb0ed83e804acfd7
MD5 6040d489232577792caa9d028065f72a
BLAKE2b-256 6a4978c4060f88d74a6490064a62cf0ac5de928c08c88db219b24887df7a1799

See more details on using hashes here.

File details

Details for the file drawdata-0.3.1-py2.py3-none-any.whl.

File metadata

  • Download URL: drawdata-0.3.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 118.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.6

File hashes

Hashes for drawdata-0.3.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6d918d5d841d60bdc2f5bc0aed50bc4878e9bdf0cd165f21c696616c5a5be1c6
MD5 b3564b3d2847be38cb3c98e0e59825a0
BLAKE2b-256 c4168e14b4690675619005b7c5a4b3636205fdcdfd26e96fbc01547ae7245532

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