def numeric_stats(self, field):

    def first(col):
        idx = col.first_valid_index()
        return (col[idx] if (idx is not None) else None)

    def last(col):
        idx = col.last_valid_index()
        return (col[idx] if (idx is not None) else None)
    assert (field in self.numeric_fields)
    if (field in self.df):
        col = self.df[field]
        return dict(min=np.nanmin(col), max=np.nanmax(col), first=first(col), last=last(col), count=np.count_nonzero((~ np.isnan(col))))
    else:
        return {}
def numeric_stats(self, field):

    def first(col):
        idx = col.first_valid_index()
        return (col[idx] if (idx is not None) else None)

    def last(col):
        idx = col.last_valid_index()
        return (col[idx] if (idx is not None) else None)
    assert (field in self.numeric_fields)
    if (field in self.df):
        col = self.df[field]
        return dict(min=np.nanmin(col), max=np.nanmax(col), first=first(col), last=last(col), count=np.count_nonzero((~ np.isnan(col))))
    else:
        return {}