aminghadersohi commented on code in PR #38277:
URL: https://github.com/apache/superset/pull/38277#discussion_r2880001527


##########
superset/mcp_service/chart/preview_utils.py:
##########
@@ -182,19 +182,23 @@ def _calculate_column_widths(
 def _format_value(val: Any, width: int) -> str:
     """Format a value based on its type."""
     if isinstance(val, float):
-        if abs(val) >= 1000000:
+        import math
+
+        if math.isnan(val):
+            val_str = "N/A"
+        elif math.isfinite(val) and val.is_integer():
+            # Integer-like float (e.g. 1988.0) — format without decimals
+            val_str = str(int(val))
+        elif abs(val) >= 1000000:
             val_str = f"{val:.2e}"  # Scientific notation for large numbers
         elif abs(val) >= 1000:
             val_str = f"{val:,.2f}"  # Thousands separator
         else:
             val_str = f"{val:.2f}"

Review Comment:
   Good catch. Changed to `:g` format to preserve significant digits. Fixed in 
b755de7.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to