Skip to main content

Render a dataset into a picture

Project description

hishiryo

Consciousness beyond thought ^_^

Hishiryo is a tool to generate a circular dataviz of any csv dataset.

This little experiment aims at trying to quickly represent the content of a dataset and make it funny to discover it's patterns!

Each datapoint (like a cell in an excel sheet) is converted into a pixel , and this pixel is diplayed on a circular graph.

This version supports the following column data formats : float, integers and text as nominal categories.

How to install

With PyPI (Make sure your pip is up to date as it can interfere with CV2 package install)

pip install hishiryo

Dependencies

  • Pandas
  • CV2 (OpenCV)
  • Pillow
  • svgwrite

How to use radial rendering

1 - find an appropriate csv. (more than 100 rows will start to overload the result a little)

2 - From your code or from a Jupyter notebook :

from hishiryo import Hishiryo

HishiryoConverter = Hishiryo.Hishiryo()

input_path = "/home/user/iris.csv"
separator = ','
output_path = "/home/user/iris.png"
radius = 500

HishiryoConverter.convertCSVToRadialBitmap(input_path,separator,output_path,radius,None,"Dot")

Arguments :

  • input path is the path to your csv file (e.g. /home/user/iris.csv)

  • output path is the path to your target image file (e.g. /home/user/iris.png) The fileformat you want is autodetected thanks to CV2 functionalities.

  • separator is the character separator in your csv (e.g. ",")

  • radius (in pixel) is the size of the radius of the disk where the pixels will be drawn. The higher it is the bigger and sharper your output image will be. (e.g: 1500)'

  • sort_by is the name of the column or the list of column you want to sort you data. (e.g. "Sepal.Length", or ["Sepal.Length","Sepal.Width"])

  • glyph_type is the type of representation you want for the pixels. it can be one among the following : "Dot","Square" or "Polygon"

      input_path = "path/to/your/csv/file.csv"
      output_path = "path/to/your/rendered/image.png"
      separator = ","
      radius = 3000
      sort_by = None
      glyph_type = "Polygon"
    

Colors are assigned based on the variable type.

  • Blue circles represent integer values
  • Red circles, float values
  • Random colors are assigned to categorical variables.
  • Black is the default value for value 0 or when there is no data

Radial bitmap rendering examples

See below an example of a visualisation generated from the train titanic dataset output example

The 12 columns of the dataset are represented as 12 circular rows. The first column is rendered as the inner circle, and the last as the outer one.

Here is an overview of the MNIST train dataset, sort by label output example

How to use simple bitmap rendering

Another way is to render your csv as a simple bitmap, without radial representation.

from hishiryo import Hishiryo

HishiryoConverter = Hishiryo.Hishiryo()

input_path = "/home/user/iris.csv"
separator = ','
output_path = "/home/user/iris.png"

HishiryoConverter.convertCSVToBitmap(input_path,
                                     output_path,
                                     separator,
                                     )

simple bitmap rendering example

Here is an extract of the MNIST test dataset () output example

Licence

GNU General Public License v3.0

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

hishiryo-0.0.3.tar.gz (20.9 kB view details)

Uploaded Source

Built Distribution

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

hishiryo-0.0.3-py3-none-any.whl (20.0 kB view details)

Uploaded Python 3

File details

Details for the file hishiryo-0.0.3.tar.gz.

File metadata

  • Download URL: hishiryo-0.0.3.tar.gz
  • Upload date:
  • Size: 20.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for hishiryo-0.0.3.tar.gz
Algorithm Hash digest
SHA256 1966c63d4798aaa545feed77f8288c64730642e4873bd4dbb00e34887a5b4576
MD5 fef5c43bd4e36cdfbe738617525f886f
BLAKE2b-256 80c4f2162167cbd82322fe186d43da50f544162a142bb796c5e6fc34ab9db4e9

See more details on using hashes here.

File details

Details for the file hishiryo-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: hishiryo-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 20.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for hishiryo-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 fcc0d8e6aab23a79ab6f6a51194ac41954570062da09cca65a5a6c6b4acd869f
MD5 85e42e5cfea2f2d3589d3f0f12e09a91
BLAKE2b-256 a880faf8c1e5ef15e65bec0b6f61431915ebc123dcd0b69d3f1cbef555d5d23f

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