You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/blog/2025-10-30-ragflow-in-practice-an-intelligent-agent-for-in-depth-research-on-company-research-reports/index.md
+20-27Lines changed: 20 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -157,32 +157,25 @@ Code:
157
157
import re
158
158
159
159
def format_number(value: str) -> str:
160
-
"""Convert scientific notation or float to formatted number with commas."""
160
+
"""Convert scientific notation or floating-point numbers to comma-separated numbers"""
161
161
try:
162
162
num = float(value)
163
163
if num.is_integer():
164
-
return f"{int(num):,}"
164
+
return f"{int(num):,}" # If it's an integer, format without decimal places
165
165
else:
166
-
return f"{num:,.2f}"
166
+
return f"{num:,.2f}" # Otherwise, keep two decimal places and add commas
167
167
except:
168
-
return value # Return as is if not a number (e.g., — or empty)
168
+
return value # Return the original value if it's not a number (e.g., — or empty)
0 commit comments