def numpy_scalar_to_python(scalar):
    """
    Converts a NumPy scalar to a regular python type.
    """
    scalar_type = type(scalar)
    if np.issubclass_(scalar_type, np.float_):
        return float(scalar)
    elif np.issubclass_(scalar_type, np.int_):
        return int(scalar)
    return scalar
def numpy_scalar_to_python ( scalar ) : scalar_type = type ( scalar ) if np . issubclass_ ( scalar_type , np . float_ ) : return float ( scalar ) elif np . issubclass_ ( scalar_type , np . int_ ) : return int ( scalar ) return scalar
Converts a NumPy scalar to a regular python type.