Skip to content

Commit f79dc95

Browse files
Copilotxadupre
andauthored
Polish waterfall implementation per review
Agent-Logs-Url: https://github.com/sdpython/teachpyx/sessions/e6e8e7c7-c0a1-47b3-9763-5ebb04affcb9 Co-authored-by: xadupre <22452781+xadupre@users.noreply.github.com>
1 parent f34b7a6 commit f79dc95

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

_unittests/ut_tools/test_pandas.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import unittest
2+
from matplotlib.axes import Axes
23
import pandas
34
from teachpyx.ext_test_case import ExtTestCase
45
from teachpyx.tools.pandas import plot_waterfall, read_csv_cached
@@ -23,7 +24,7 @@ def test_plot_waterfall(self):
2324
}
2425
)
2526
ax, plot_df = plot_waterfall(df, "delta", "name", total_label="TOTAL")
26-
self.assertEqual(ax.__class__.__name__, "Axes")
27+
self.assertIsInstance(ax, Axes)
2728
self.assertEqual(list(plot_df["label"]), ["A", "B", "C", "TOTAL"])
2829
self.assertEqual(list(plot_df["start"]), [0.0, 10.0, 7.0, 0.0])
2930
self.assertEqual(list(plot_df["end"]), [10.0, 7.0, 12.0, 12.0])

teachpyx/tools/pandas.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def plot_waterfall(
9797
}
9898
)
9999

100-
total = float(values.sum()) if len(values) > 0 else 0.0
100+
total = float(values.sum())
101101
total_row = pandas.DataFrame(
102102
{
103103
"label": [total_label],

0 commit comments

Comments
 (0)