from typing import Union
import math


def check_nan(data: Union[int, float]) -> Union[str, float, int]:
    """Check if a number is Nan.

    Returns a string that can be JSON serialised.

    Args:
        data: Number
    Returns:
        str, float, int: Returns NA if not a number else number
    """
    if math.isnan(data):
        return "NA"
    else:
        return round(data, 3)