Skip to content

Commit 82b1c6c

Browse files
committed
Fix: Add total row and improve table formatting in code-1.py
1 parent 1585aa3 commit 82b1c6c

File tree

1 file changed

+3
-3
lines changed
  • apps/plotly_examples/src/python_code_for_variations/Tables

1 file changed

+3
-3
lines changed

apps/plotly_examples/src/python_code_for_variations/Tables/code1.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import plotly.graph_objects as go
21
import json
2+
import plotly.graph_objects as go
33

44
# Create the table
55
products = ["Apples", "Bananas", "Oranges"]
@@ -11,7 +11,7 @@
1111
header=dict(values=["Product", "Quantity", "Price", "Total"]),
1212
cells=dict(values=[products + ["Total"],
1313
quantities + [sum(quantities)],
14-
prices + [""],
14+
prices + [None],
1515
totals + [sum(totals)]])
1616
)])
1717

@@ -23,4 +23,4 @@
2323
f.write(fig_json)
2424

2525
# Optional: print preview of JSON (first 300 characters)
26-
print(fig_json[:300])
26+
print("Preview of exported JSON:\n", fig_json[:300], "...")

0 commit comments

Comments
 (0)