_to_jsonable
Internal helper
This page documents an internal implementation helper, not a primary public API.
Source code in src/fabricops_kit/quality.py
73
74
75
76
77
78
79
80
81
82 | def _to_jsonable(value: Any) -> Any:
if isinstance(value, (datetime, pd.Timestamp)):
return value.isoformat()
if isinstance(value, dict):
return {k: _to_jsonable(v) for k, v in value.items()}
if isinstance(value, list):
return [_to_jsonable(v) for v in value]
if isinstance(value, float) and (math.isnan(value) or math.isinf(value)):
return None
return value
|