I am storing the results from a sklearn regression model to the varibla prediction.
prediction = regressor.predict(data[[\'X\']]) print(prediction) >
prediction = regressor.predict(data[[\'X\']]) print(prediction)
You can use pandas. As it's said, numpy arrays don't have a to_csv function.
import numpy as np import pandas as pd prediction = pd.DataFrame(predictions, columns=['predictions']).to_csv('prediction.csv')
add ".T" if you want either your values in line or column-like.