Skip to content

Commit

Permalink
use round numbers in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
wspr committed Apr 1, 2024
1 parent 7f94362 commit c9f944b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 26 deletions.
30 changes: 16 additions & 14 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,29 @@ The data to plot is first created in a Pandas dataFrame:

```
import pandas as pd
data = pd.DataFrame([
(“apple”, 1 , “apple”, 0.5),
(“banana”, 2 , “banana”, 3 ),
(“lime”, 0.5, “lime”, 0.2),
(“blueberry”, 0.2, “blueberry”, 1 ),
(“orange”, 1.5, “orange”, 1.5),
])
data = pd.DataFrame(
[
("apple", 100, "apple", 50),
("banana", 200, "banana", 30),
("lime", 50, "lime", 20),
("blueberry", 20, "blueberry", 10),
("orange", 150, "orange", 150),
]
)
```
Note that there can be as many columns as you like and they are always presented in pairs of “label” then “weight”. (Unweighted diagrams – currently – would require you to simple put a weight of 1.0 for each label.)

A three column dataset might look like:
```
data3 = pd.DataFrame(
[
(“a”, 1.0, “ab”, 2.0, “a” , 1.0),
(“a”, 1.0, “ba”, 0.8, “ba”, 0.4),
(“c”, 1.5, “cd”, 0.5, “d” , 2.0),
(“b”, 0.5, “ba”, 0.8, “ba”, 0.4),
(“b”, 0.5, “ab”, 0.8, “a” , 1.0),
(“d”, 2.0, “cd”, 0.4, “d” , 1.0),
(“e”, 1.0, “e” , 1.0, “e” , 3.0),
("a", 3, "ab", 6, "a" , 3),
("a", 3, "ba", 2, "ba", 1),
("c", 5, "cd", 3, "d" , 6),
("b", 2, "ba", 2, "ba", 1),
("b", 2, "ab", 2, "a" , 3),
("d", 6, "cd", 1, "d" , 3),
("e", 2, "e" , 3, "e" , 8),
]
)
```
Expand Down
24 changes: 12 additions & 12 deletions docs/sankey_doc_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@

data = pd.DataFrame(
[
("apple", 1, "apple", 0.5),
("banana", 2, "banana", 3),
("lime", 0.5, "lime", 0.2),
("blueberry", 0.2, "blueberry", 1),
("orange", 1.5, "orange", 1.5),
("apple", 100, "apple", 50),
("banana", 200, "banana", 30),
("lime", 50, "lime", 20),
("blueberry", 20, "blueberry", 10),
("orange", 150, "orange", 150),
]
)

data3 = pd.DataFrame(
[
("a", 1.0, "ab", 2.0, "a" , 1.0),
("a", 1.0, "ba", 0.8, "ba", 0.4),
("c", 1.5, "cd", 0.5, "d" , 2.0),
("b", 0.5, "ba", 0.8, "ba", 0.4),
("b", 0.5, "ab", 0.8, "a" , 1.0),
("d", 2.0, "cd", 0.4, "d" , 1.0),
("e", 1.0, "e" , 1.0, "e" , 3.0),
("a", 3, "ab", 6, "a" , 3),
("a", 3, "ba", 2, "ba", 1),
("c", 5, "cd", 3, "d" , 6),
("b", 2, "ba", 2, "ba", 1),
("b", 2, "ab", 2, "a" , 3),
("d", 6, "cd", 1, "d" , 3),
("e", 2, "e" , 3, "e" , 8),
]
)

Expand Down

0 comments on commit c9f944b

Please sign in to comment.