All Projects → anazalea → Pysankey

anazalea / Pysankey

Licence: gpl-3.0
create sankey diagrams with matplotlib

Projects that are alternatives of or similar to Pysankey

Crypto Rnn
Learning the Enigma with Recurrent Neural Networks
Stars: ✭ 139 (-0.71%)
Mutual labels:  jupyter-notebook
Dnp
Audio Denoising with Deep Network Priors
Stars: ✭ 140 (+0%)
Mutual labels:  jupyter-notebook
Imageprocessing
MicaSense RedEdge and Altum image processing tutorials
Stars: ✭ 139 (-0.71%)
Mutual labels:  jupyter-notebook
Ipytest
Pytest in IPython notebooks.
Stars: ✭ 139 (-0.71%)
Mutual labels:  jupyter-notebook
Voc2coco
How to create custom COCO data set for object detection
Stars: ✭ 140 (+0%)
Mutual labels:  jupyter-notebook
Rootfinder
Arabic root finder with neural nets!
Stars: ✭ 140 (+0%)
Mutual labels:  jupyter-notebook
Finrl Library
FinRL: Financial Reinforcement Learning Framework. Please star. 🔥
Stars: ✭ 3,037 (+2069.29%)
Mutual labels:  jupyter-notebook
Python For Algorithms Data Structures And Interviews
Files for Udemy Course on Algorithms and Data Structures
Stars: ✭ 1,917 (+1269.29%)
Mutual labels:  jupyter-notebook
Categoricalencodingbenchmark
Benchmarking different approaches for categorical encoding for tabular data
Stars: ✭ 140 (+0%)
Mutual labels:  jupyter-notebook
Interactive machine learning
IPython widgets, interactive plots, interactive machine learning
Stars: ✭ 140 (+0%)
Mutual labels:  jupyter-notebook
Intro To Tensorflow
This is an introduction to tensorflow
Stars: ✭ 139 (-0.71%)
Mutual labels:  jupyter-notebook
Dash eth
This project is trying to fetch real time balance & orderbook of ETH and visualise using dash
Stars: ✭ 140 (+0%)
Mutual labels:  jupyter-notebook
Popmusicmaker
Pop Music Maker built on HMM and Random Forest-like structure. Inspired by the desire to build my own model can serve as alternative to LSTMs / deep learning in generating pop music. Website is currently down due to costs incurred.
Stars: ✭ 140 (+0%)
Mutual labels:  jupyter-notebook
Coco Text
COCO-Text API http://vision.cornell.edu/se3/coco-text/
Stars: ✭ 138 (-1.43%)
Mutual labels:  jupyter-notebook
Benchmarks
Comparison tools
Stars: ✭ 139 (-0.71%)
Mutual labels:  jupyter-notebook
Widendeep
wide and deep labs and samples
Stars: ✭ 139 (-0.71%)
Mutual labels:  jupyter-notebook
Interactive Corporate Report
ICR - Automated and Intelligent Company Report Built in Python (by @firmai)
Stars: ✭ 139 (-0.71%)
Mutual labels:  jupyter-notebook
Nlpaug
Data augmentation for NLP
Stars: ✭ 2,761 (+1872.14%)
Mutual labels:  jupyter-notebook
Practical Machine Learning With Python
Master the essential skills needed to recognize and solve complex real-world problems with Machine Learning and Deep Learning by leveraging the highly popular Python Machine Learning Eco-system.
Stars: ✭ 1,868 (+1234.29%)
Mutual labels:  jupyter-notebook
Recotour
A tour through recommendation algorithms in python [IN PROGRESS]
Stars: ✭ 140 (+0%)
Mutual labels:  jupyter-notebook

pySankey

Uses matplotlib to create simple Sankey diagrams flowing only from left to right.

PyPI version Build Status Coverage Status

Requirements

Requires python-tk (for python 2.7) or python3-tk (for python 3.x) you can install the other requirements with:

    pip install -r requirements.txt

Example

With fruits.txt :

true predicted
0 blueberry orange
1 lime orange
2 blueberry lime
3 apple orange
... ... ...
996 lime orange
997 blueberry orange
998 orange banana
999 apple lime

1000 rows × 2 columns

You can generate a sankey's diagram with this code:

import pandas as pd
from pysankey import sankey

pd.options.display.max_rows = 8
df = pd.read_csv(
    'pysankey/fruits.txt', sep=' ', names=['true', 'predicted']
)
colorDict = {
    'apple':'#f71b1b',
    'blueberry':'#1b7ef7',
    'banana':'#f3f71b',
    'lime':'#12e23f',
    'orange':'#f78c1b'
}
sankey(
    df['true'], df['predicted'], aspect=20, colorDict=colorDict,
    fontsize=12, figureName="fruit"
)
# Result is in "fruit.png"

Fruity Alchemy

You could also use weight:

,customer,good,revenue
0,John,fruit,5.5
1,Mike,meat,11.0
2,Betty,drinks,7.0
3,Ben,fruit,4.0
4,Betty,bread,2.0
5,John,bread,2.5
6,John,drinks,8.0
7,Ben,bread,2.0
8,Mike,bread,3.5
9,John,meat,13.0
import pandas as pd
from pysankey import sankey

df = pd.read_csv(
    'pysankey/customers-goods.csv', sep=',',
    names=['id', 'customer', 'good', 'revenue']
)
sankey(
    left=df['customer'], right=df['good'], rightWeight=df['revenue'], aspect=20,
    fontsize=20, figureName="customer-good"
)
# Result is in "customer-good.png"

Customer goods

Package development

Lint

pylint pysankey

Testing

python -m unittest

Coverage

coverage run -m unittest
coverage html
# Open htmlcov/index.html in a navigator
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].