Numpy has a “savetxt” method which saves numpy array to csv file. numpy.savetxt¶ numpy.savetxt(fname, X, fmt='%.18e', delimiter=' ', newline='\n', header='', footer='', comments='# ') [source] ¶ Save an array to a text file. Use “genfromtxt” method to read csv file into a numpy array. answered May 24, 2019 by Puneet Thank you very much. This function takes a filename and array as arguments and saves the array into CSV format. When you are using numpy.savetxt() function to save numy array into a text file, you my get this error: TypeError: Mismatch between array dtype ('