Skip to content

Commit 90a5382

Browse files
Copilotxadupre
andauthored
Remove try/except from waterfall numeric conversion
Agent-Logs-Url: https://github.com/sdpython/teachpyx/sessions/51a3850a-5547-4962-a7d6-829066c3c6ff Co-authored-by: xadupre <22452781+xadupre@users.noreply.github.com>
1 parent bbdac40 commit 90a5382

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

teachpyx/tools/pandas.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,7 @@ def plot_waterfall(
7777
if len(colors) != 3:
7878
raise ValueError(f"colors must contain 3 values, not {len(colors)}.")
7979

80-
try:
81-
values = pandas.to_numeric(data[value_column], errors="raise").astype(float)
82-
except ValueError as exc:
83-
raise ValueError(
84-
f"Column {value_column!r} cannot be converted to numeric values."
85-
) from exc
80+
values = pandas.to_numeric(data[value_column], errors="raise").astype(float)
8681
labels = data[label_column] if label_column is not None else data.index
8782
labels = labels.astype(str)
8883

0 commit comments

Comments
 (0)