def drop_falsey_uncertainty_fields_but_keep_zeros(db):
    "Drop fields like '' but keep zero and NaN.\n\n    Note that this doesn't strip `False`, which behaves *exactly* like 0.\n\n    "
    uncertainty_fields = ['minimum', 'maximum', 'scale', 'shape', 'loc']

    def drop_if_appropriate(exc):
        for field in uncertainty_fields:
            if ((field not in exc) or (exc[field] == 0)):
                continue
            elif (isinstance(exc[field], numbers.Number) and np.isnan(exc[field])):
                continue
            elif (not exc[field]):
                del exc[field]
    for ds in db:
        for exc in ds['exchanges']:
            drop_if_appropriate(exc)
    return db
Drop fields like '' but keep zero and NaN.

Note that this doesn't strip `False`, which behaves *exactly* like 0.
def drop_falsey_uncertainty_fields_but_keep_zeros(db):
    "Drop fields like  but keep zero and NaN.\n\n    Note that this doesn't strip `False`, which behaves *exactly* like 0.\n\n    "
    uncertainty_fields = ['minimum', 'maximum', 'scale', 'shape', 'loc']

    def drop_if_appropriate(exc):
        for field in uncertainty_fields:
            if ((field not in exc) or (exc[field] == 0)):
                continue
            elif (isinstance(exc[field], numbers.Number) and np.isnan(exc[field])):
                continue
            elif (not exc[field]):
                del exc[field]
    for ds in db:
        for exc in ds['exchanges']:
            drop_if_appropriate(exc)
    return db