Python reads txt files into dataframe

Insert picture description here

y = pd.read_csv('.\data\y.txt', sep='\t', header=None)
y.columns = ['y%s'%i for i in range(1, y.shape[1]+1)]

y.txtThe data is like this, there is a tab character in the middle \t, if an error is reported, then you may need to add an escape character before the pathr
Insert picture description here

Guess you like

Origin blog.csdn.net/Caiqiudan/article/details/112996042