Skip to content

Commit

Permalink
fix NaN bug
Browse files Browse the repository at this point in the history
  • Loading branch information
wspr committed May 30, 2024
1 parent b0e029a commit efe6ef8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ausankey/ausankey.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,8 @@ def __init__(
def setup(self, data):
"""Calculates all parameters needed to plot the graph"""

self.data = data
self.data = data.fillna(np.nan).replace([np.nan], [None])
# replaces NaN etc with None

num_col = len(self.data.columns)
self.data.columns = range(num_col) # force numeric column headings
Expand All @@ -373,7 +374,7 @@ def setup(self, data):
if (
val < self.other_thresh_val
or val < self.other_thresh_sum * self.weight_sum[ii]
or val < self.other_thresh_max * max(self.data[2 * ii + 1])
or val < self.other_thresh_max * np.max(self.data[2 * ii + 1])
):
self.data.iat[nn, 2 * ii] = self.other_name
self.weight_labels()
Expand Down Expand Up @@ -700,7 +701,7 @@ def subplot(self, ii):
if not (
val < self.value_thresh_val
or val < self.value_thresh_sum * self.weight_sum[ii + lr]
or val < self.value_thresh_max * max(self.data[2 * ii + 1])
or val < self.value_thresh_max * np.max(self.data[2 * ii + 1])
):
self.draw_value(
x_lr[lr] + (1 - 2 * lr) * self.x_value_gap,
Expand Down
5 changes: 5 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Changelog for ausankey


## 2024-99-99 v1.5

* Allow NaN or None when flows terminate.


## 2024-05-29 v1.4

* Fix alignment bug when nodes were changing their
Expand Down

0 comments on commit efe6ef8

Please sign in to comment.