Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[split] Python Question
#3
(Feb-28-2020, 02:42 PM)Larz60+ Wrote: one method: use two step process:
first convert dataframe to html using pandas.DataFrame.to_html:
https://pandas.pydata.org/pandas-docs/ve..._html.html

next convert html file to pdf using pdfkit (if you need to install, use pip install pdfkit)
import pdfkit as pdk

pdk.from_file(path, htmlfilename)

I have tried like below
import pandas as pd
df = pd.DataFrame(np.random.random((10,3)), columns = ("col 1", "col 2", "col 3"))

df1 =df.to_html(df.info())
pdk.from_file('htm.pdf', df1)

it is not working
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,301 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