Skip to content

Conversation

juleswg23
Copy link
Contributor

@juleswg23 juleswg23 commented Aug 13, 2025

Summary

Work in Progress for new feature, grand summary rows

This PR summary will be updated

Related GitHub Issues and PRs

Checklist

@juleswg23 juleswg23 changed the title Feat: grand summary rows Feat: add grand_summary_rows() method Aug 13, 2025
Copy link

codecov bot commented Aug 13, 2025

Codecov Report

❌ Patch coverage is 95.93496% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.58%. Comparing base (1624005) to head (e429de5).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
great_tables/_gt_data.py 91.76% 7 Missing ⚠️
great_tables/_locations.py 92.85% 2 Missing ⚠️
great_tables/_tbl_data.py 95.65% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #765      +/-   ##
==========================================
+ Coverage   91.45%   91.58%   +0.13%     
==========================================
  Files          47       47              
  Lines        5558     5752     +194     
==========================================
+ Hits         5083     5268     +185     
- Misses        475      484       +9     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions github-actions bot temporarily deployed to pr-765 August 13, 2025 22:01 Destroyed
@github-actions github-actions bot temporarily deployed to pr-765 August 14, 2025 15:03 Destroyed
@github-actions github-actions bot temporarily deployed to pr-765 August 14, 2025 17:56 Destroyed
@github-actions github-actions bot temporarily deployed to pr-765 August 14, 2025 18:30 Destroyed
@github-actions github-actions bot temporarily deployed to pr-765 August 14, 2025 18:30 Destroyed
@github-actions github-actions bot temporarily deployed to pr-765 August 14, 2025 18:32 Destroyed
@github-actions github-actions bot temporarily deployed to pr-765 August 14, 2025 19:04 Destroyed
if columns is not None:
raise NotImplementedError(
"Currently, grand_summary_rows() does not support column selection."
)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently we raise an error, which is documented in the docstring. Flagging in a comment just in case there's a better way to stub this out.

@github-actions github-actions bot temporarily deployed to pr-765 August 28, 2025 16:16 Destroyed
def grand_summary_rows(
self: GTSelf,
fns: dict[str, PlExpr] | dict[str, Callable[[TblData], Any]],
fmt: FormatFn | None = None,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having used this in a couple cases, I am leaning towards accepting a function instead of a FormatFn, the same way that fmt() can take a custom-built fn. I haven't explore the implementation details of this switch.

# Replace with numeric values from new row
for key, new_value in summary_row.values.items():
if isinstance(new_value, (int, float)):
merged_values[key] = new_value
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can tell this is not the ideal way, since we can't guarantee that summary values have to be numeric.

_heading=Heading(),
_stubhead=None,
_summary_rows=SummaryRows(),
_summary_rows_grand=SummaryRows(_is_grand_summary=True),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like _is_grand_summary is used so that for methods like __getitem__ and add_summary_rows() some arguments that are required for regular summary rows can be optional for the grand one.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to punt on any refactoring of SummaryRows(). I'll note it seems like the list in list[SummaryRowInfo] is doing a lot of heavy lifting. For example, it can be...

  • filtered by side
  • appended to
  • tasked with replacing an existing SummaryRowInfo with a new one (whose id is the same)

Whereas SummaryRows is mostly a dictionary (with methods in this implementation to work on those lists).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mutations removed for now, so should be okay as is

@machow machow self-requested a review October 8, 2025 17:53
Copy link
Collaborator

@machow machow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, I think this is ready to go! I don't remember looking at the new doc pages closely (and I added one hidden doc called "technical-notes"). @rich-iannone do you mind taking a look at this / merging if it looks okay?!

Copy link
Collaborator

@machow machow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, I think this is ready to go! I don't remember looking at the new doc pages closely (and I added one hidden doc called "technical-notes"). @rich-iannone do you mind taking a look at this / merging if it looks okay?!

Copy link
Collaborator

@machow machow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, I think this is ready to go! I don't remember looking at the new doc pages closely (and I added one hidden doc called "technical-notes"). @rich-iannone do you mind taking a look at this / merging if it looks okay?!

@rich-iannone
Copy link
Member

Thanks so much @juleswg23 and @machow for your work on this. I'll review shortly and merge if everything is looking good!

Copy link
Member

@rich-iannone rich-iannone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@rich-iannone rich-iannone merged commit 85d25f6 into main Oct 8, 2025
14 checks passed
@rich-iannone rich-iannone deleted the feat-grand-summary-rows branch October 8, 2025 20:46
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.

3 participants