Handle numpy.nan values during writing to the database