Skip to content

Instantly share code, notes, and snippets.

@neerajadsul
Created March 4, 2023 10:37
Show Gist options
  • Save neerajadsul/b40925055e9617f6c4b9de347b7be4eb to your computer and use it in GitHub Desktop.
Save neerajadsul/b40925055e9617f6c4b9de347b7be4eb to your computer and use it in GitHub Desktop.
Combine columns of NumPy array and write as CSV File
from sklearn.datasets import make_moons
X,y = make_moons(n_samples=200, noise=0.15)
with open('data.csv', 'w') as f:
wr = csv.writer(f, delimiter=',')
combined = np.column_stack((X,y))
wr.writerows(combined)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment