import numpy as np import pandas as pd txt = np.loadtxt('data1.txt') txtDF = pd.DataFrame(txt) txtDF.to_csv('file1.csv', index=False)