def to_scalar_safe(obj):
    try:
        return np.asscalar(obj)
    except:
        return obj
Convert a numpy data type to a standard python scalar.
dataset/ETHPy150Open UDST/urbansim/urbansim/utils/yamlio.py/to_scalar_safe