How do I transform a file to .txt file using pandas?
pandas.to_csv() as you might know is part of pandas owned IO-API (InputOutput API).
Currently panas is providing 18 different formats in this context.
And of course pandas is also able to write txt-files. With other words pandas is a multi data converter:
Pandas IO tools
To do so with pandas use to_csv with the sep='\t' attribute:
df.to_csv('data.txt', sep='\t')
The next option you have to do it with numpy in that way, which is a bit laborious:

Call pd.DataFrame.to_numpy() to convert a pd.DataFrame to a NumPy array
Use np.savetxt(fname, X, fmt = &quot;%s&quot;) with the string &quot;%d&quot; as fmt and the NumPy array as X to write the contents of X into the file fname.