1

После предикшена я получил CSV file

output = pd.DataFrame({'Id': test_data.Id,
                       'SalePrice': test_preds})
output.to_csv('submission.csv', index=False)

Но как мне сделать файл без заголовков Id и SalePrice - он сразу должен начинаться с этих двух значений:

1 0.3442
2 2.1312
и т.д.

1 ответ 1

1

Воспользуйтесь параметром header=False:

header : bool or list of str, default True

Write out the column names. If a list of strings is given it is assumed to be aliases for the column names.

Changed in version 0.24.0: Previously defaulted to False for Series.

output.to_csv('submission.csv', index=False, header=False)

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.