(value: Any, digits: int = 4)
| 77 | |
| 78 | |
| 79 | def format_cell(value: Any, digits: int = 4) -> str: |
| 80 | if value is None: |
| 81 | return "N/A" |
| 82 | if isinstance(value, int): |
| 83 | return str(value) |
| 84 | if isinstance(value, float): |
| 85 | if not math.isfinite(value): |
| 86 | return "N/A" |
| 87 | return f"{value:.{digits}f}" |
| 88 | return str(value) |
| 89 | |
| 90 | |
| 91 | def normalize_topic(value: Any) -> str: |