IPython is showing the repr
of the dataframe:
with open(filename, 'w') as f:
f.write(repr(df))
Question
Is there any way to save a DataFrame to disk as a string, using the format and alignment that IPython uses to display it?
Note that I would like to save the full dataframe, and not just a summary (i.e. head & tail) of it.
Solution
IPython is showing the repr
of the dataframe:
with open(filename, 'w') as f:
f.write(repr(df))