Spaces:
Sleeping
Sleeping
Upload main.py
Browse files182 unmodified lines183184185186187188186189190191192193194195182 unmodified lines num_str = str(value).replace('$', '').replace(',', '').strip()
if not num_str or num_str.lower() == 'n/a': return 'N/A'
num = float(num_str)
# Check if the number has decimal places
if num == int(num):
# For whole numbers, display without decimal places
return f"${num:,.0f}"
return f"${num:,.0f}"
else:
# For numbers with decimal places, preserve them
return f"${num:,}"
except (ValueError, TypeError):
# Allow text like "Event", "Unobtainable" etc. to pass through
if isinstance(value, str) and value.strip() and not re.match(r'^-?[\d,.$]+\$?$', value.strip()):main.py+7-1