The conventional csv
is not human reader friendly and therefore, I am writing tab-separated pandas dataframe using following command:
df.to_csv ('output.txt', index = False, header=True, float_format='%.3f', sep='\t')
This results in the output in the following format:
A B C D
90.856 1.214 0.417 1.858
363.424 0.616 0.302 1.858
1817.121 0.318 0.000 1.858
2180.545 0.296 0.000 1.858
However, I want the output file to look like this:
A B C D
90.856 1.214 0.417 1.858
363.424 0.616 0.302 1.858
1817.121 0.318 0.000 1.858
2180.545 0.296 0.000 1.858
I do not care about how much space is between the columns but I want the column data aligned properly. How to achieve this?