Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Make awesome display tables using Python

License

NotificationsYou must be signed in to change notification settings

posit-dev/great-tables

Repository files navigation

Absolutely Delightful Table-making in Python

Python VersionsPyPIPyPI DownloadsLicense

CI BuildCodecov branchRepo StatusDocumentation

ContributorsDiscordpyOpenSci Peer-ReviewedDOIContributor Covenant

WithGreat Tables anyone can make wonderful-looking tables in Python. The philosophy here is that we can construct a wide variety of useful tables by working with a cohesive set of table components. You can mix and match things like aheader andfooter, attach astub (which contains row labels), arrangespanner labels over top of thecolumn labels, and much more. Not only that, but you can format the cell values in a variety of awesome ways.

It all begins withtable data in the form of a Pandas or Polars DataFrame. You then decide how to compose your output table with the elements and formatting you need for the task at hand. Finally, the table is rendered to HTML (the default option) or to an image file.

TheGreat Tables package is designed to be both straightforward yet powerful. The emphasis is on simple methods for the everyday display table needs (but power when you need it). Here is a brief example of how to useGreat Tables to create a table from the includedsp500 dataset:

fromgreat_tablesimportGTfromgreat_tables.dataimportsp500# Define the start and end dates for the data rangestart_date="2010-06-07"end_date="2010-06-14"# Filter sp500 using Pandas to dates between `start_date` and `end_date`sp500_mini=sp500[(sp500["date"]>=start_date)& (sp500["date"]<=end_date)]# Create a display table based on the `sp500_mini` table data(GT(sp500_mini)    .tab_header(title="S&P 500",subtitle=f"{start_date} to{end_date}")    .fmt_currency(columns=["open","high","low","close"])    .fmt_date(columns="date",date_style="wd_m_day_year")    .fmt_number(columns="volume",compact=True)    .cols_hide(columns="adj_close"))

Typically we use Great Tables in an notebook environment or within aQuarto document. Tables won't print to the console, but using theshow() method on a table object while in the console will open the HTML table in your default browser.

There are 16 datasets provided byGreat Tables:countrypops,sza,gtcars,sp500,pizzaplace,exibble,towny,peeps,films,metro,gibraltar,constants,illness,reactions,photolysis, andnuclides.

All of this tabular data is great for experimenting with the functionality available insideGreat Tables and we make extensive use of these datasets in our documentation.

Beyond the methods shown in the simplesp500-based example, there are many possible ways to create super-customized tables. Check out thedocumentation website to get started via introductory articles for makingGreat Tables. There's a handyReference section that has detailed help for every method and function in the package.

Documentation Site

Let's talk about how to makeGreat Tables! There are a few locations where there is much potential for discussion.

One such place is inGitHub Discussions. This discussion board is especially great for Q&A, and many people have had their problems solved in there.

GitHub Discussions

Another fine venue for discussion is in ourDiscord server. This is a good option for asking about the development ofGreat Tables, pitching ideas that may become features, and sharing your table creations!

Discord Server

Finally, there is theX account. There you'll find posts aboutGreat Tables (including sneak previews about in-development features) and other table-generation packages.

X Follow

These are all great places to ask questions about how to use the package, discuss some ideas, engage with others, and much more!

INSTALLATION

TheGreat Tables package can be installed fromPyPI with:

$ pip install great_tables

You can also installGreat Tables from Conda-Forge by using:

conda install conda-forge::great_tables

If you encounter a bug, have usage questions, or want to share ideas to make this package better, please feel free to file anissue.

Code of Conduct

Please note that theGreat Tables project is released with acontributor code of conduct.
By participating in this project you agree to abide by its terms.

Contributing toGreat Tables

There are many ways to contribute to the ongoing development of theGreat Tables package. Some contributions can be simple (like fixing typos, improving documentation, filing issues for feature requests or problems, etc.) and others might take more time and care (like answering questions and submitting PRs with code changes). Just know that anything you can do to help would be very much appreciated!

Please read over thecontributing guidelines for information on how to get started.

📄 License

Great Tables is licensed under the MIT license.

© Posit Software, PBC.

Citation

If you useGreat Tables in your research/project/product, we would appreciate a citation to the package. You can cite the package using the following BibTeX entry:

@software{Iannone_great_tables,author ={Iannone, Richard and Chow, Michael},license ={MIT},title ={{great-tables: Make awesome display tables using Python.}},url ={https://github.com/posit-dev/great-tables},version ={0.14.0}}

🏛️ Governance

This project is primarily maintained byRich Iannone andMichael Chow.Other authors may occasionally assist with some of these duties.


[8]ページ先頭

©2009-2025 Movatter.jp