implement table_to_ndarray