Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[split] Python Question
#5
Alternative -
import sys 
import pandas as pd

sys.stdout = open('xxxstdout.txt','w')
df = pd.DataFrame() 
print(df.describe)
Then use a library function to convert the text file to a pdf.

Changing the value of stdout redirects all print (and the prompt part of input) statements to the new file. __stdout__ is the value of stdout when the program starts, so you do want to put it back once you are done with the text file generation.

sys.stdout = sys.__stdout__
Reply


Messages In This Thread
[split] Python Question - by osreddy - Feb-28-2020, 07:06 AM
RE: [split] Python Question - by Larz60+ - Feb-28-2020, 02:42 PM
RE: [split] Python Question - by osreddy - Feb-29-2020, 05:28 AM
RE: [split] Python Question - by Larz60+ - Feb-29-2020, 11:26 AM
RE: [split] Python Question - by jefsummers - Feb-29-2020, 07:08 PM
RE: [split] Python Question - by snippsat - Feb-29-2020, 09:19 PM
RE: [split] Python Question - by osreddy - Mar-26-2020, 03:58 PM
RE: [split] Python Question - by buran - Mar-26-2020, 04:07 PM
RE: [split] Python Question - by osreddy - Mar-26-2020, 04:10 PM
RE: [split] Python Question - by buran - Mar-26-2020, 04:15 PM
RE: [split] Python Question - by osreddy - May-07-2020, 03:23 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [split] [split] New to the forum, how to post a question? karnik 2 1,300 Feb-12-2022, 03:45 PM
Last Post: deanhystad
  [split] question about list comprehension Armin 17 5,832 Jan-29-2020, 04:32 PM
Last Post: Clunk_Head

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020