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

feat: add fmt_icon() method #515

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from
Draft

feat: add fmt_icon() method #515

wants to merge 14 commits into from

Conversation

rich-iannone
Copy link
Member

This PR adds the fmt_icon() method. It depends on Font Awesome icons available in the faicons library, so that is a new dependency. Whenever that package is updated, new icons from the FA free set will be available. Here's an example of the fmt_icon() method in use:

import pandas as pd
from great_tables import GT
animals_foods_df = pd.DataFrame(
    {
        "animals": ["hippo", "fish,spider", "mosquito,locust,frog", "dog,cat", "kiwi-bird"],
        "foods": ["bowl-rice", "egg,pizza-slice", "burger,lemon,cheese", "carrot,hotdog", "bacon"],
    }
)
(
    GT(animals_foods_df)
    .fmt_icon(
        columns=["animals", "foods"],
        height="4em"
    )
    .cols_align(
        align="center",
        columns=["animals", "foods"]
    )
)
image

Copy link

codecov bot commented Nov 20, 2024

Codecov Report

Attention: Patch coverage is 85.71429% with 7 lines in your changes missing coverage. Please review.

Project coverage is 89.08%. Comparing base (aa7d553) to head (0e9e9e6).

Files with missing lines Patch % Lines
great_tables/_formats.py 85.41% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #515      +/-   ##
==========================================
- Coverage   89.11%   89.08%   -0.04%     
==========================================
  Files          44       44              
  Lines        5220     5269      +49     
==========================================
+ Hits         4652     4694      +42     
- Misses        568      575       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@github-actions github-actions bot temporarily deployed to pr-515 November 20, 2024 20:03 Destroyed
@github-actions github-actions bot temporarily deployed to pr-515 November 20, 2024 20:21 Destroyed
@github-actions github-actions bot temporarily deployed to pr-515 November 20, 2024 21:30 Destroyed
@github-actions github-actions bot temporarily deployed to pr-515 November 20, 2024 22:21 Destroyed
@github-actions github-actions bot temporarily deployed to pr-515 November 21, 2024 15:30 Destroyed
@github-actions github-actions bot temporarily deployed to pr-515 November 21, 2024 15:54 Destroyed
@github-actions github-actions bot temporarily deployed to pr-515 November 21, 2024 18:15 Destroyed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant