Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs not explicit about render env #619

Open
zachvalenta opened this issue Feb 21, 2025 · 1 comment
Open

docs not explicit about render env #619

zachvalenta opened this issue Feb 21, 2025 · 1 comment

Comments

@zachvalenta
Copy link

If one runs the code from the docs intro from the REPL:

from great_tables import GT, md, html
from great_tables.data import islands

islands_mini = islands.head(10)

# Create a display table showing ten of the largest islands in the world
gt_tbl = GT(islands_mini)
# Show the output table
gt_tbl

it produces...not a great table:

Image

If run as a script:

python great-tables-intro.py

it produces...nothing:

Image

seems like the intro, in order to just work™️, should be updated to:

  • produce something that can be rendered
from great_tables import GT, md, html
from great_tables.data import islands

islands_mini = islands.head(10)
gt_tbl = GT(islands_mini)
GT.write_raw_html(
    gt_tbl,
    'tbl.html',
    encoding='utf-8',
    newline=None,
    make_page=False,
    all_important=False,
)
  • specify how to render i.e. "open the HTML file in the browser"
@rich-iannone
Copy link
Member

Thanks for raising this. The trick here is to call the show() method on gt_tbl (which then should open the default browser and display the table in a new page). We mention this in the README but not in the Get Started guide. So, I think there should be a callout there.

I'll also try to reproduce the script-running method (with show()) to see if that works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants