Improved printing df to file