Rewrite _df_to_vector to make better use of pandas