Writing to csv file

i have got my predictions,but how to write them to csv file.,what would be the code, mine is not working

Lets say you have your predictions in y_pred
Now,

df = pd.DataFrame(y_pred, columns=["y"])
df.to_csv(path_to_csv, index=False)

Here, path_to_csv is the location where you want to save your prediction as a csv.

Happy Learning :slight_smile:
Thanks