Please refer to this answer
Dump a NumPy array into a csv file
Also i think you don't need to load the data in numpy array as it is already in csv format. You can just write the raw data in a .csv
file.
with open('csv_file.csv', 'wb') as file:
file.write(raw_data.read())
That should suffice.
So to sum up, If you want to use use numpy to write the csv then
import urllib.request as urllib
import numpy as np
url = "https://archive.ics.uci.edu/ml/machine-learning-databases/spambase/spambase.data"
raw_data = urllib.urlopen(url)
mydataset = np.loadtxt(raw_data, delimiter=",")
np.savetxt("foo.csv", mydataset, delimiter=",")
And easier and faster is to just write the raw data
import urllib.request as urllib
import numpy as np
url = "https://archive.ics.uci.edu/ml/machine-learning-databases/spambase/spambase.data"
raw_data = urllib.urlopen(url)
with open('csv_file.csv', 'wb') as file:
file.write(raw_data.read())